Comment and divide out tests for requirements

This commit is contained in:
Dan Ryan
2018-02-11 04:05:32 -05:00
parent 92e58fe97e
commit 7fb93b699b
+15
View File
@@ -253,25 +253,40 @@ twine = "*"
@pytest.mark.requirements
def test_get_requirements(self):
# Test eggs in URLs
url_with_egg = pipenv.utils.get_requirement('https://github.com/IndustriaTech/django-user-clipboard/archive/0.6.1.zip#egg=django-user-clipboard')
assert url_with_egg.uri == 'https://github.com/IndustriaTech/django-user-clipboard/archive/0.6.1.zip'
assert url_with_egg.name == 'django-user-clipboard'
# Test URLs without eggs pointing at installable zipfiles
url = pipenv.utils.get_requirement('https://github.com/kennethreitz/tablib/archive/0.12.1.zip')
assert url.uri == 'https://github.com/kennethreitz/tablib/archive/0.12.1.zip'
# Test VCS urls with refs and eggnames
vcs_url = pipenv.utils.get_requirement('git+https://github.com/kennethreitz/tablib.git@master#egg=tablib')
assert vcs_url.vcs == 'git' and vcs_url.name == 'tablib' and vcs_url.revision == 'master'
assert vcs_url.uri == 'git+https://github.com/kennethreitz/tablib.git'
# Test normal package requirement
normal = pipenv.utils.get_requirement('tablib')
assert normal.name == 'tablib'
# Pinned package requirement
spec = pipenv.utils.get_requirement('tablib==0.12.1')
assert spec.name == 'tablib' and spec.specs == [('==', '0.12.1')]
# Test complex package with both extras and markers
extras_markers = pipenv.utils.get_requirement("requests[security]; os_name=='posix'")
assert extras_markers.extras == ['security']
assert extras_markers.name == 'requests'
assert extras_markers.markers == "os_name=='posix'"
# Test VCS uris get generated correctly, retain git+git@ if supplied that way, and are named according to egg fragment
git_reformat = pipenv.utils.get_requirement('-e git+git@github.com:pypa/pipenv.git#egg=pipenv')
assert git_reformat.uri == 'git+git@github.com:pypa/pipenv.git'
assert git_reformat.name == 'pipenv'
assert git_reformat.editable
# Previously VCS uris were being treated as local files, so make sure these are not handled that way
assert not git_reformat.local_file
# Test regression where VCS uris were being handled as paths rather than VCS entries
assert git_reformat.vcs == 'git'