From fe6920bc2f425f6e15e6cc6b225e2995032a9488 Mon Sep 17 00:00:00 2001 From: Devesh Kumar Singh Date: Wed, 8 Apr 2020 13:59:33 +0530 Subject: [PATCH] Addressed review comments --- tests/functional/test_check.py | 4 ++-- tests/functional/test_freeze.py | 14 +++++++++++--- tests/functional/test_install.py | 6 ++++-- tests/functional/test_show.py | 4 ++-- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/tests/functional/test_check.py b/tests/functional/test_check.py index ae13d07fd..4e9a144bf 100644 --- a/tests/functional/test_check.py +++ b/tests/functional/test_check.py @@ -281,11 +281,11 @@ def test_check_include_work_dir_pkg(script): script.run('python', 'setup.py', 'egg_info', expect_stderr=True, cwd=pkg_path) - # Add PYTHONPATH env variable script.environ.update({'PYTHONPATH': pkg_path}) # Check should mention about missing requirement simple - # when run from package directory + # when run from package directory, when package directory + # is in PYTHONPATH result = script.pip('check', expect_error=True, cwd=pkg_path) expected_lines = ( "simple 1.0 requires missing, which is not installed.", diff --git a/tests/functional/test_freeze.py b/tests/functional/test_freeze.py index b3fb9bce1..44278c866 100644 --- a/tests/functional/test_freeze.py +++ b/tests/functional/test_freeze.py @@ -819,6 +819,14 @@ def test_freeze_path_multiple(tmpdir, script, data): _check_output(result.stdout, expected) +def test_freeze_direct_url_archive(script, shared_data, with_wheel): + req = "simple @ " + path_to_url(shared_data.packages / "simple-2.0.tar.gz") + assert req.startswith("simple @ file://") + script.pip("install", req) + result = script.pip("freeze") + assert req in result.stdout + + def test_freeze_skip_work_dir_pkg(script): """ Test that freeze should not include package @@ -833,7 +841,7 @@ def test_freeze_skip_work_dir_pkg(script): # Freeze should not include package simple when run from package directory result = script.pip('freeze', cwd=pkg_path) - assert 'simple==1.0' not in result.stdout + assert 'simple' not in result.stdout def test_freeze_include_work_dir_pkg(script): @@ -848,9 +856,9 @@ def test_freeze_include_work_dir_pkg(script): script.run('python', 'setup.py', 'egg_info', expect_stderr=True, cwd=pkg_path) - # Add PYTHONPATH env variable script.environ.update({'PYTHONPATH': pkg_path}) - # Freeze should include package simple when run from package directory + # Freeze should include package simple when run from package directory, + # when package directory is in PYTHONPATH result = script.pip('freeze', cwd=pkg_path) assert 'simple==1.0' in result.stdout diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py index c1c84e487..328bc6eb7 100644 --- a/tests/functional/test_install.py +++ b/tests/functional/test_install.py @@ -1842,6 +1842,8 @@ def test_install_skip_work_dir_pkg(script, data): result = script.pip('install', '--find-links', data.find_links, 'simple', expect_stderr=True, cwd=pkg_path) + + assert 'Requirement already satisfied: simple' not in result.stdout assert 'Successfully installed simple' in result.stdout @@ -1861,10 +1863,10 @@ def test_install_include_work_dir_pkg(script, data): # Uninstall will fail with given warning script.pip('uninstall', 'simple', '-y') - # Add PYTHONPATH env variable script.environ.update({'PYTHONPATH': pkg_path}) - # Uninstalling the package and installing it again will fail + # Uninstalling the package and installing it again will fail, + # when package directory is in PYTHONPATH result = script.pip('install', '--find-links', data.find_links, 'simple', expect_stderr=True, cwd=pkg_path) diff --git a/tests/functional/test_show.py b/tests/functional/test_show.py index ba0e9d407..c19228b56 100644 --- a/tests/functional/test_show.py +++ b/tests/functional/test_show.py @@ -291,10 +291,10 @@ def test_show_include_work_dir_pkg(script): script.run('python', 'setup.py', 'egg_info', expect_stderr=True, cwd=pkg_path) - # Add PYTHONPATH env variable script.environ.update({'PYTHONPATH': pkg_path}) - # Show should include package simple when run from package directory + # Show should include package simple when run from package directory, + # when package directory is in PYTHONPATH result = script.pip('show', 'simple', cwd=pkg_path) lines = result.stdout.splitlines() assert 'Name: simple' in lines