From f89013daa487333407a73c951e52d2aefd9c640e Mon Sep 17 00:00:00 2001 From: Chris Hunt Date: Sat, 11 Jan 2020 19:37:10 -0500 Subject: [PATCH] Parametrize editable for relative install tests --- tests/functional/test_install.py | 18 ++++++++++-------- tests/functional/test_install_reqs.py | 21 +++++++++++---------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py index 2e8b0d982..90ceec539 100644 --- a/tests/functional/test_install.py +++ b/tests/functional/test_install.py @@ -406,12 +406,15 @@ def test_basic_install_from_local_directory(script, data): assert egg_info_folder in result.files_created, str(result) -@pytest.mark.parametrize("test_type", [ - ("rel_path"), - ("rel_url"), - ("embedded_rel_path"), +@pytest.mark.parametrize("test_type,editable", [ + ("rel_path", False), + ("rel_path", True), + ("rel_url", False), + ("rel_url", True), + ("embedded_rel_path", False), + ("embedded_rel_path", True), ]) -def test_basic_install_relative_directory(script, data, test_type): +def test_basic_install_relative_directory(script, data, test_type, editable): """ Test installing a requirement using a relative path. """ @@ -439,14 +442,13 @@ def test_basic_install_relative_directory(script, data, test_type): }[test_type] # Install as either editable or not. - if True: - # Regular install. + if not editable: result = script.pip('install', req_path, cwd=script.scratch_path) assert egg_info_file in result.files_created, str(result) assert package_folder in result.files_created, str(result) script.pip('uninstall', '-y', 'fspkg') - + else: # Editable install. result = script.pip('install', '-e' + req_path, cwd=script.scratch_path) diff --git a/tests/functional/test_install_reqs.py b/tests/functional/test_install_reqs.py index a340c09e8..47c92757e 100644 --- a/tests/functional/test_install_reqs.py +++ b/tests/functional/test_install_reqs.py @@ -57,12 +57,15 @@ def test_schema_check_in_requirements_file(script): ) -@pytest.mark.parametrize("test_type", [ - ("rel_path"), - ("rel_url"), - ("embedded_rel_path"), +@pytest.mark.parametrize("test_type,editable", [ + ("rel_path", False), + ("rel_path", True), + ("rel_url", False), + ("rel_url", True), + ("embedded_rel_path", False), + ("embedded_rel_path", True), ]) -def test_relative_requirements_file(script, data, test_type): +def test_relative_requirements_file(script, data, test_type, editable): """ Test installing from a requirements file with a relative path. For path URLs, use an egg= definition. @@ -89,10 +92,9 @@ def test_relative_requirements_file(script, data, test_type): "embedded_rel_path": embedded_rel_path, }[test_type] + req_path = req_path.replace(os.path.sep, '/') # Install as either editable or not. - if True: - req_path = req_path.replace(os.path.sep, '/') - # Regular install. + if not editable: with requirements_file(req_path + '\n', script.scratch_path) as reqs_file: result = script.pip('install', '-vvv', '-r', reqs_file.name, @@ -100,8 +102,7 @@ def test_relative_requirements_file(script, data, test_type): assert egg_info_file in result.files_created, str(result) assert package_folder in result.files_created, str(result) script.pip('uninstall', '-y', 'fspkg') - - # Editable install. + else: with requirements_file('-e ' + req_path + '\n', script.scratch_path) as reqs_file: result = script.pip('install', '-vvv', '-r', reqs_file.name,