Пример #1
0
from dephell.models import Requirement
from dephell.repositories import WareHouseRepo


@pytest.mark.parametrize('converter, path', [
    (converters.PIPConverter(lock=False),
     Path('tests') / 'requirements' / 'attrs-requests.txt'),
    (converters.PIPConverter(lock=False),
     Path('tests') / 'requirements' / 'django-deal.txt'),
    (converters.PIPConverter(lock=False),
     Path('tests') / 'requirements' / 'scipy-pandas-numpy.txt'),
    (converters.PIPFileConverter(),
     Path('tests') / 'requirements' / 'pipfile.toml'),
    (converters.PIPFileLockConverter(),
     Path('tests') / 'requirements' / 'pipfile.lock.json'),
    (converters.FlitConverter(), Path('tests') / 'requirements' / 'flit.toml'),
    (converters.PoetryConverter(),
     Path('tests') / 'requirements' / 'poetry.toml'),
    (converters.PoetryLockConverter(),
     Path('tests') / 'requirements' / 'poetry.lock.toml'),
    (converters.SetupPyConverter(),
     Path('tests') / 'requirements' / 'setup.py'),
    (converters.EggInfoConverter(),
     Path('tests') / 'requirements' / 'egg-info'),
    (converters.WheelConverter(),
     Path('tests') / 'requirements' / 'wheel.whl'),
])
def test_load_dump_load_deps(converter, path):
    root1 = converter.load(path)
    reqs1 = Requirement.from_graph(graph=Graph(root1), lock=False)
Пример #2
0
from dephell import converters
from dephell.controllers import DependencyMaker, Graph, RepositoriesRegistry
from dephell.models import Requirement, RootDependency

root_path = Path(__file__).parent.parent / 'requirements'


@pytest.mark.allow_hosts()
@pytest.mark.parametrize('converter, path', [
    (converters.PIPConverter(lock=False), root_path / 'attrs-requests.txt'),
    (converters.PIPConverter(lock=False), root_path / 'django-deal.txt'),
    (converters.PIPConverter(lock=False),
     root_path / 'scipy-pandas-numpy.txt'),
    (converters.PIPFileConverter(), root_path / 'pipfile.toml'),
    (converters.PIPFileLockConverter(), root_path / 'pipfile.lock.json'),
    (converters.FlitConverter(), root_path / 'flit.toml'),
    (converters.PoetryConverter(), root_path / 'poetry.toml'),
    (converters.PoetryLockConverter(), root_path / 'poetry.lock.toml'),
    (converters.SetupPyConverter(), root_path / 'setup.py'),
    (converters.EggInfoConverter(), root_path / 'egg-info'),
    (converters.WheelConverter(), root_path / 'wheel.whl'),
])
def test_load_dump_load_deps(converter, path):
    root1 = converter.load(path)
    reqs1 = Requirement.from_graph(graph=Graph(root1), lock=False)

    content = converter.dumps(reqs1, project=root1)
    root2 = converter.loads(content)
    reqs2 = Requirement.from_graph(graph=Graph(root2), lock=False)

    map1 = {req.name: req for req in reqs1}