예제 #1
0
def test_python_dist_info_conda_dependencies_3():
    test_files = (('', 'METADATA', ('Name: foo\n')), )
    temp_path, fpaths = _create_test_files(test_files)
    path = os.path.dirname(fpaths[0])

    dist = PythonEggInfoDistribution(path, "3.6", None)
    depends, constrains = dist.get_conda_dependencies()
    assert "python 3.6.*" in depends
예제 #2
0
파일: test_python.py 프로젝트: conda/conda
def test_basepydist_load_requires_provides_file():
    temp_path, fpaths = _create_test_files((('', 'depends.txt', 'foo\n\n[a]\nbar\n'), ))

    dist = PythonEggInfoDistribution(temp_path, "1.8", None)
    exp_req, exp_extra = (['foo', 'bar; extra == "a"'], ['a'])
    req, extra = dist._load_requires_provides_file()
    _print_output((list(sorted(req)), extra), (list(sorted(exp_req)), exp_extra))
    assert (list(sorted(req)), extra) == (list(sorted(exp_req)), exp_extra)
예제 #3
0
def test_basepydist_load_requires_provides_file():
    temp_path, fpaths = _create_test_files((('', 'depends.txt', 'foo\n\n[a]\nbar\n'), ))

    dist = PythonEggInfoDistribution(temp_path, "1.8", None)
    exp_req, exp_extra = (['foo', 'bar; extra == "a"'], ['a'])
    req, extra = dist._load_requires_provides_file()
    _print_output((list(sorted(req)), extra), (list(sorted(exp_req)), exp_extra))
    assert (list(sorted(req)), extra) == (list(sorted(exp_req)), exp_extra)
예제 #4
0
def test_python_dist_egg_path():
    test_files = (('', 'installed-files.txt', 'foo/bar\nfoo/spam\n'), )
    temp_path, fpaths = _create_test_files(test_files)
    path = os.path.dirname(fpaths[0])

    dist = PythonEggInfoDistribution(path, "2.7", None)
    paths = dist.get_paths()
    _print_output(paths)
    assert len(paths) == 2
예제 #5
0
파일: test_python.py 프로젝트: conda/conda
def test_python_dist_info_conda_dependencies_3():
    test_files = (
        ('', 'METADATA', ('Name: foo\n')),
    )
    temp_path, fpaths = _create_test_files(test_files)
    path = os.path.dirname(fpaths[0])

    dist = PythonEggInfoDistribution(path, "3.6", None)
    depends, constrains = dist.get_conda_dependencies()
    assert "python 3.6.*" in depends
예제 #6
0
def test_python_dist_info_conda_dependencies():
    test_files = (('', 'METADATA',
                   ('Name: foo\n'
                    'Requires-Python: >2.7,<5.0\n'
                    'Requires-Dist: bar ; python_version == "2.7"\n'
                    'Requires-Dist: spam ; python_version == "4.9"\n'
                    'Provides-Extra: docs\n'
                    'Requires-Dist: cheese >=1.0; extra == "docs"\n')), )
    temp_path, fpaths = _create_test_files(test_files)
    path = os.path.dirname(fpaths[0])

    dist = PythonEggInfoDistribution(path, "4.9", None)
    depends, constrains = dist.get_conda_dependencies()
    assert 'python 4.9.*' in depends
    assert 'bar' not in depends
    assert 'spam' in depends
    assert 'cheese >=1.0' in constrains

    dist = PythonEggInfoDistribution(path, "2.7", None)
    depends, constrains = dist.get_conda_dependencies()
    assert 'python 2.7.*' in depends
    assert 'bar' in depends
    assert 'spam' not in depends
    assert 'cheese >=1.0' in constrains

    dist = PythonEggInfoDistribution(path, "3.4", None)
    depends, constrains = dist.get_conda_dependencies()
    assert 'python 3.4.*' in depends
    assert 'bar' not in depends
    assert 'spam' not in depends
    assert 'cheese >=1.0' in constrains
예제 #7
0
파일: test_python.py 프로젝트: conda/conda
def test_python_dist_egg_path():
    test_files = (
        ('', 'installed-files.txt', 'foo/bar\nfoo/spam\n'),
    )
    temp_path, fpaths = _create_test_files(test_files)
    path = os.path.dirname(fpaths[0])

    dist = PythonEggInfoDistribution(path, "2.7", None)
    paths = dist.get_paths()
    _print_output(paths)
    assert len(paths) == 2
예제 #8
0
파일: test_python.py 프로젝트: conda/conda
def test_get_extra_provides():
    test_files = (
        ('', 'METADATA', 'Name: spam\n'),
        ('', 'requires.txt', 'foo >1.0\n[a]\nbar\n'),
    )
    temp_path, fpaths = _create_test_files(test_files)

    dist = PythonEggInfoDistribution(temp_path, "2.7", None)
    output = dist.get_extra_provides()
    expected_output = ['a']
    _print_output(output, expected_output)
    assert output == expected_output
예제 #9
0
파일: test_python.py 프로젝트: conda/conda
def test_get_entry_points():
    test_files = (
        ('', 'METADATA', 'Name: spam\n'),
        ('', 'entry_points.txt', '[console_scripts]\ncheese = cli:main\n'),
    )
    temp_path, fpaths = _create_test_files(test_files)

    dist = PythonEggInfoDistribution(temp_path, "2.7", None)
    output = dist.get_entry_points()
    expected_output = odict(console_scripts=odict(cheese='cli:main'))
    _print_output(output, expected_output)
    assert output == expected_output
예제 #10
0
파일: test_python.py 프로젝트: conda/conda
def test_dist_get_paths():
    content = 'foo/bar,sha256=1,"45"\nfoo/spam,,\n'
    temp_path, fpaths = _create_test_files((('', 'SOURCES.txt', content), ))

    sp_dir = get_python_site_packages_short_path("2.7")

    dist = PythonEggInfoDistribution(temp_path, "2.7", None)
    output = dist.get_paths()
    expected_output = [(join_url(sp_dir, "foo", "bar"), '1', 45),
                       (join_url(sp_dir, "foo", "spam"), None, None)]
    _print_output(output, expected_output)
    assert output == expected_output
예제 #11
0
파일: test_python.py 프로젝트: conda/conda
def test_get_dist_requirements():
    test_files = (
        ('', 'METADATA', 'Name: spam\n'),
        ('', 'requires.txt', 'foo >1.0'),
    )
    temp_path, fpaths = _create_test_files(test_files)

    dist = PythonEggInfoDistribution(temp_path, "2.7", None)
    output = dist.get_dist_requirements()
    expected_output = frozenset({'foo >1.0'})
    _print_output(output, expected_output)
    assert output == expected_output
예제 #12
0
def test_get_dist_requirements():
    test_files = (
        ('', 'METADATA', 'Name: spam\n'),
        ('', 'requires.txt', 'foo >1.0'),
    )
    temp_path, fpaths = _create_test_files(test_files)

    dist = PythonEggInfoDistribution(temp_path, "2.7", None)
    output = dist.get_dist_requirements()
    expected_output = frozenset({'foo >1.0'})
    _print_output(output, expected_output)
    assert output == expected_output
예제 #13
0
def test_dist_get_paths():
    content = 'foo/bar,sha256=1,"45"\nfoo/spam,,\n'
    temp_path, fpaths = _create_test_files((('', 'SOURCES.txt', content), ))

    sp_dir = get_python_site_packages_short_path("2.7")

    dist = PythonEggInfoDistribution(temp_path, "2.7", None)
    output = dist.get_paths()
    expected_output = [(join_url(sp_dir, "foo", "bar"), '1', 45),
                       (join_url(sp_dir, "foo", "spam"), None, None)]
    _print_output(output, expected_output)
    assert output == expected_output
예제 #14
0
def test_get_extra_provides():
    test_files = (
        ('', 'METADATA', 'Name: spam\n'),
        ('', 'requires.txt', 'foo >1.0\n[a]\nbar\n'),
    )
    temp_path, fpaths = _create_test_files(test_files)

    dist = PythonEggInfoDistribution(temp_path, "2.7", None)
    output = dist.get_extra_provides()
    expected_output = ['a']
    _print_output(output, expected_output)
    assert output == expected_output
예제 #15
0
def test_get_entry_points():
    test_files = (
        ('', 'METADATA', 'Name: spam\n'),
        ('', 'entry_points.txt', '[console_scripts]\ncheese = cli:main\n'),
    )
    temp_path, fpaths = _create_test_files(test_files)

    dist = PythonEggInfoDistribution(temp_path, "2.7", None)
    output = dist.get_entry_points()
    expected_output = odict(console_scripts=odict(cheese='cli:main'))
    _print_output(output, expected_output)
    assert output == expected_output
예제 #16
0
def test_python_dist_egg_fpath():
    test_files = (('', 'zoom.egg-info', 'Name: Zoom\nVersion: 1.0\n'), )
    temp_path, fpaths = _create_test_files(test_files)

    dist = PythonEggInfoDistribution(fpaths[0], "2.2", None)
    assert dist.name == 'Zoom'
    assert dist.norm_name == 'zoom'
    assert dist.version == '1.0'
예제 #17
0
파일: test_python.py 프로젝트: conda/conda
def test_python_dist_info_conda_dependencies():
    test_files = (
        ('', 'METADATA', ('Name: foo\n'
                          'Requires-Python: >2.7,<5.0\n'
                          'Requires-Dist: bar ; python_version == "2.7"\n'
                          'Requires-Dist: spam ; python_version == "4.9"\n'
                          'Provides-Extra: docs\n'
                          'Requires-Dist: cheese >=1.0; extra == "docs"\n'
                          )
         ),
    )
    temp_path, fpaths = _create_test_files(test_files)
    path = os.path.dirname(fpaths[0])

    dist = PythonEggInfoDistribution(path, "4.9", None)
    depends, constrains = dist.get_conda_dependencies()
    assert 'python 4.9.*' in depends
    assert 'bar' not in depends
    assert 'spam' in depends
    assert 'cheese >=1.0' in constrains

    dist = PythonEggInfoDistribution(path, "2.7", None)
    depends, constrains = dist.get_conda_dependencies()
    assert 'python 2.7.*' in depends
    assert 'bar' in depends
    assert 'spam' not in depends
    assert 'cheese >=1.0' in constrains

    dist = PythonEggInfoDistribution(path, "3.4", None)
    depends, constrains = dist.get_conda_dependencies()
    assert 'python 3.4.*' in depends
    assert 'bar' not in depends
    assert 'spam' not in depends
    assert 'cheese >=1.0' in constrains
예제 #18
0
def test_dist_get_paths_no_paths():
    temp_path = tempfile.mkdtemp()
    dist = PythonEggInfoDistribution(temp_path, "2.7", None)
    with pytest.raises(EnvironmentError):
        paths = dist.get_paths()
예제 #19
0
파일: test_python.py 프로젝트: conda/conda
def test_dist_get_paths_no_paths():
    temp_path = tempfile.mkdtemp()
    dist = PythonEggInfoDistribution(temp_path, "2.7", None)
    with pytest.raises(EnvironmentError):
        paths = dist.get_paths()