summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon L. Reiss <brandon@damyata.co>2017-04-05 18:32:36 -0400
committerBrandon L. Reiss <brandon@damyata.co>2017-04-05 18:38:26 -0400
commitc932706bbe9b1bd4e0e4a1698e5b9689163f130e (patch)
treecb0bc4a688fca80340d4bb3cf4ba261791a5e6c0
parent97667d55f11a6ad38dc6ad0081391c08ea935373 (diff)
downloadpip-c932706bbe9b1bd4e0e4a1698e5b9689163f130e.tar.gz
Split relative paths tests to avoid timeout
Tests are timing out and also not following requirements/install test factorization. Split to conform to test organization and to prevent test timeout.
-rw-r--r--tests/functional/test_install.py56
-rw-r--r--tests/functional/test_install_reqs.py51
2 files changed, 60 insertions, 47 deletions
diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py
index 4f779aff7..0057d81e8 100644
--- a/tests/functional/test_install.py
+++ b/tests/functional/test_install.py
@@ -271,46 +271,40 @@ def test_install_from_local_directory(script, data):
assert egg_info_folder in result.files_created, str(result)
-def test_install_from_relative_directory(script, data):
+def test_install_relative_directory(script, data):
"""
- Test installing requirements using a relative path.
+ Test installing a requirement using a relative path.
"""
- fspkg_folder = script.site_packages / 'fspkg'
- egg_info_folder = (
+ egg_info_file = (
script.site_packages / 'FSPkg-0.1.dev0-py%s.egg-info' % pyversion
)
egg_link_file = (
script.site_packages / 'FSPkg.egg-link'
)
-
- # Create directories in scratch of varying depth to test relative path to
- # requirements.
- for relative_depth in range(2):
- # Setup scratch dir with given depth. This is where we call pip from.
- my_dir = script.scratch_path.join(
- *[str(i) for i in range(relative_depth)]).mkdir()
-
- # Compute relative install path to FSPkg.
- to_install_relative = data.packages.join("FSPkg") - my_dir
-
- # Install from relative path using direct pip invocation.
- result = script.pip('install', to_install_relative, cwd=my_dir)
- assert fspkg_folder in result.files_created, str(result)
- assert egg_info_folder in result.files_created, str(result)
+ package_folder = script.site_packages / 'fspkg'
+
+ # Compute relative install path to FSPkg from scratch path.
+ full_rel_path = data.packages.join('FSPkg') - script.scratch_path
+ embedded_rel_path = script.scratch_path.join(full_rel_path)
+
+ # For each relative path, install as either editable or not using either
+ # URLs with egg links or not.
+ for req_path in (full_rel_path,
+ 'file:' + full_rel_path + '?egg=FSPkg',
+ embedded_rel_path,
+ 'file:' + embedded_rel_path + '?egg=FSPkg'):
+ # Regular install.
+ 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')
- # Install from relative path using requirements files.
- for reqs_fmt, assert_path in (('{rel_dir}', egg_info_folder),
- ('file:{rel_dir}', egg_info_folder),
- ('-e file:{rel_dir}', egg_link_file),
- ('-e {rel_dir}', egg_link_file)):
- with requirements_file(
- reqs_fmt.format(rel_dir=to_install_relative),
- my_dir) as reqs_file:
- result = script.pip_install_local('-r', reqs_file.name,
- cwd=my_dir)
- assert assert_path in result.files_created, str(result)
- script.pip('uninstall', '-y', 'fspkg')
+ # Editable install.
+ result = script.pip('install', '-e' + req_path,
+ cwd=script.scratch_path)
+ assert egg_link_file in result.files_created, str(result)
+ script.pip('uninstall', '-y', 'fspkg')
def test_install_quiet(script, data):
diff --git a/tests/functional/test_install_reqs.py b/tests/functional/test_install_reqs.py
index f3b4cfbee..eba98139f 100644
--- a/tests/functional/test_install_reqs.py
+++ b/tests/functional/test_install_reqs.py
@@ -3,7 +3,7 @@ import textwrap
import pytest
-from tests.lib import (pyversion, path_to_url, requirements_file,
+from tests.lib import (pyversion, requirements_file,
_create_test_package_with_subdirectory)
from tests.lib.local_repos import local_checkout
@@ -53,25 +53,44 @@ def test_schema_check_in_requirements_file(script):
def test_relative_requirements_file(script, data):
"""
- Test installing from a requirements file with a relative path with an
- egg= definition..
+ Test installing from a requirements file with a relative path. For path
+ URLs, use an egg= definition.
"""
- url = path_to_url(
- os.path.join(data.root, "packages", "..", "packages", "FSPkg")
- ) + '#egg=FSPkg'
- script.scratch_path.join("file-egg-req.txt").write(textwrap.dedent("""\
- %s
- """ % url))
- result = script.pip(
- 'install', '-vvv', '-r', script.scratch_path / 'file-egg-req.txt'
- )
- assert (
+ egg_info_file = (
script.site_packages / 'FSPkg-0.1.dev0-py%s.egg-info' % pyversion
- ) in result.files_created, str(result)
- assert (script.site_packages / 'fspkg') in result.files_created, (
- str(result.stdout)
)
+ egg_link_file = (
+ script.site_packages / 'FSPkg.egg-link'
+ )
+ package_folder = script.site_packages / 'fspkg'
+
+ # Compute relative install path to FSPkg from scratch path.
+ full_rel_path = data.packages.join('FSPkg') - script.scratch_path
+ embedded_rel_path = script.scratch_path.join(full_rel_path)
+
+ # For each relative path, install as either editable or not using either
+ # URLs with egg links or not.
+ for req_path in (full_rel_path,
+ 'file:' + full_rel_path + '?egg=FSPkg',
+ embedded_rel_path,
+ 'file:' + embedded_rel_path + '?egg=FSPkg'):
+ # Regular install.
+ with requirements_file(req_path + '\n',
+ script.scratch_path) as reqs_file:
+ result = script.pip('install', '-vvv', '-r', reqs_file.name,
+ 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')
+
+ # Editable install.
+ with requirements_file('-e ' + req_path + '\n',
+ script.scratch_path) as reqs_file:
+ result = script.pip('install', '-vvv', '-r', reqs_file.name,
+ cwd=script.scratch_path)
+ assert egg_link_file in result.files_created, str(result)
+ script.pip('uninstall', '-y', 'fspkg')
@pytest.mark.network