def test_collect_python_requirements(tmpdir):
    common.makeproject(tmpdir, 'test-project', deps=[('mod1', ''), ('mod2', '')], imports=['mod1', 'mod2'])
    project_dir = os.path.join(tmpdir, 'test-project')
    libs_dir = os.path.join(project_dir, 'libs')
    common.makemodule(libs_dir, 'mod1', project=False)
    mod1 = os.path.join(libs_dir, 'mod1')
    mod1_req_txt = 'iplib@git+https://github.com/bartv/python3-iplib\npytest>=1.5\n\n\niplib>=0.0.1\n    '
    common.add_file(mod1, 'requirements.txt', mod1_req_txt, msg='initial commit')
    common.makemodule(libs_dir, 'mod2', project=False)
    mod2 = os.path.join(libs_dir, 'mod2')
    mod2_req_txt = '# A comment\ndummy-yummy # A comment\n # Another comment\n\n    '
    common.add_file(mod2, 'requirements.txt', mod2_req_txt, msg='initial commit')
    project = Project(project_dir, venv_path=os.path.join(project_dir, '.env'))
    Project.set(project)
    project.load_module('mod1', allow_v1=True)
    project.load_module('mod2', allow_v1=True)
    reqs = project.collect_python_requirements()
    expected_reqs = ['iplib@git+https://github.com/bartv/python3-iplib', 'pytest>=1.5', 'iplib>=0.0.1', 'dummy-yummy']
    assert (sorted(reqs) == sorted(expected_reqs))
def test_collect_python_requirements(tmpdir):
    common.makeproject(tmpdir, 'test-project', deps=[('mod1', ), ('mod2', )], imports=['mod1', 'mod2'])
    project_dir = os.path.join(tmpdir, 'test-project')
    libs_dir = os.path.join(project_dir, 'libs')
    common.makemodule(libs_dir, 'mod1', project=False)
    mod1 = os.path.join(libs_dir, 'mod1')
    mod1_req_txt = 'iplib@git+https://github.com/bartv/python3-iplib\npytest>=1.5\n\n\niplib>=0.0.1\n    '
    common.add_file(mod1, 'requirements.txt', mod1_req_txt, msg='initial commit')
    common.makemodule(libs_dir, 'mod2', project=False)
    mod2 = os.path.join(libs_dir, 'mod2')
    mod2_req_txt = '# A comment\ndummy-yummy # A comment\n # Another comment\n\n    '
    common.add_file(mod2, 'requirements.txt', mod2_req_txt, msg='initial commit')
    project = Project(project_dir, venv_path=os.path.join(project_dir, '.env'))
    Project.set(project)
    project.load_module('mod1', allow_v1=True)
    project.load_module('mod2', allow_v1=True)
    reqs = project.collect_python_requirements()
    expected_reqs = ['iplib@git+https://github.com/bartv/python3-iplib', 'pytest>=1.5', 'iplib>=0.0.1', 'dummy-yummy']
    assert (sorted(reqs) == sorted(expected_reqs))