Beispiel #1
0
def test_resolvable_directory():
    builder = ResolverOptionsBuilder()

    with make_source_dir(name='my_project') as td:
        rdir = ResolvableDirectory.from_string(td, builder)
        assert rdir.name == pkg_resources.safe_name('my_project')
        assert rdir.extras() == []

        rdir = ResolvableDirectory.from_string(td + '[extra1,extra2]', builder)
        assert rdir.name == pkg_resources.safe_name('my_project')
        assert rdir.extras() == ['extra1', 'extra2']
Beispiel #2
0
def test_resolvable_directory():
  builder = ResolverOptionsBuilder()

  with make_source_dir(name='my_project') as td:
    rdir = ResolvableDirectory.from_string(td, builder)
    assert rdir.name == pkg_resources.safe_name('my_project')
    assert rdir.extras() == []

    rdir = ResolvableDirectory.from_string(td + '[extra1,extra2]', builder)
    assert rdir.name == pkg_resources.safe_name('my_project')
    assert rdir.extras() == ['extra1', 'extra2']
Beispiel #3
0
def test_resolve_extra_setup_py():
    # type: () -> None
    with make_source_dir(
        name="project1", version="1.0.0", extras_require={"foo": ["project2"]}
    ) as project1_dir:
        project2_wheel = build_wheel(name="project2", version="2.0.0")
        with temporary_dir() as td:
            safe_copy(project2_wheel, os.path.join(td, os.path.basename(project2_wheel)))

            resolved_dists = local_resolve_multi(["{}[foo]".format(project1_dir)], find_links=[td])
            assert {_parse_requirement(req) for req in ("project1==1.0.0", "project2==2.0.0")} == {
                _parse_requirement(resolved_dist.requirement) for resolved_dist in resolved_dists
            }
Beispiel #4
0
def test_resolve_extra_setup_py():
  with make_source_dir(name='project1',
                       version='1.0.0',
                       extras_require={'foo': ['project2']}) as project1_dir:
    project2_sdist = make_sdist(name='project2', version='2.0.0')
    with temporary_dir() as td:
      safe_copy(project2_sdist, os.path.join(td, os.path.basename(project2_sdist)))
      fetchers = [Fetcher([td])]

      resolved_dists = do_resolve_multi(['{}[foo]'.format(project1_dir)], fetchers=fetchers)
      assert ({_parse_requirement(req) for req in ('project1[foo]==1.0.0',
                                                   'project2; extra=="foo"')} ==
              {_parse_requirement(resolved_dist.requirement) for resolved_dist in resolved_dists})
Beispiel #5
0
def test_resolve_extra_setup_py():
    with make_source_dir(name='project1',
                         version='1.0.0',
                         extras_require={'foo': ['project2']}) as project1_dir:
        project2_wheel = build_wheel(name='project2', version='2.0.0')
        with temporary_dir() as td:
            safe_copy(project2_wheel,
                      os.path.join(td, os.path.basename(project2_wheel)))

            resolved_dists = local_resolve_multi(
                ['{}[foo]'.format(project1_dir)], find_links=[td])
            assert ({
                _parse_requirement(req)
                for req in ('project1==1.0.0', 'project2==2.0.0')
            } == {
                _parse_requirement(resolved_dist.requirement)
                for resolved_dist in resolved_dists
            })