mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
31301b1536
- Fix requirement parsing - Add appveyor config - cutover from pathlib to pathlib2 if needed - Pin pathlib2==2.1.0 to avoid scandir - Windows script runner fix - Backport `shlex.quote()` for use in `pipenv run` - Update tests and appveyor Signed-off-by: Dan Ryan <dan@danryan.co>
35 lines
2.3 KiB
Python
35 lines
2.3 KiB
Python
# -*- coding=utf-8 -*-
|
|
import os
|
|
import pytest
|
|
from first import first
|
|
from pipenv import requirements
|
|
from pipenv.utils import get_requirement, convert_deps_from_pip, convert_deps_to_pip
|
|
|
|
|
|
class TestRequirements:
|
|
|
|
@pytest.mark.requirement
|
|
@pytest.mark.parametrize(
|
|
'line, pipfile',
|
|
[
|
|
['requests', {'requests': '*'}],
|
|
['requests[socks]', {'requests': {'extras': ['socks'], 'version': '*'}}],
|
|
['django>1.10', {'django': '>1.10'}],
|
|
['requests[socks]>1.10', {'requests': {'extras': ['socks'], 'version': '>1.10'}}],
|
|
['-e git+git://github.com/pinax/pinax.git@1.4#egg=pinax', {'pinax': {'git': 'git://github.com/pinax/pinax.git', 'ref': '1.4', 'editable': True}}],
|
|
['git+git://github.com/pinax/pinax.git@1.4#egg=pinax', {'pinax': {'git': 'git://github.com/pinax/pinax.git', 'ref': '1.4'}}],
|
|
['FooProject==1.2 --hash=sha256:2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824', {'FooProject': {'version': '==1.2', 'hash': 'sha256:2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824'}}],
|
|
['FooProject[stuff]==1.2 --hash=sha256:2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824', {'FooProject': {'version': '==1.2', 'extras': ['stuff'], 'hash': 'sha256:2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824'}}],
|
|
['git+https://github.com/requests/requests.git@master#egg=requests[security]', {'requests': {'git': 'https://github.com/requests/requests.git', 'ref': 'master', 'extras': ['security']}}],
|
|
['-e svn+svn://svn.myproject.org/svn/MyProject#egg=MyProject', {u'MyProject': {u'svn': u'svn://svn.myproject.org/svn/MyProject', 'editable': True}}],
|
|
['hg+http://hg.myproject.org/MyProject@da39a3ee5e6b#egg=MyProject', {'MyProject': {'hg': 'http://hg.myproject.org/MyProject', 'ref': 'da39a3ee5e6b'}}]
|
|
]
|
|
)
|
|
def test_pip_requirements(self, line, pipfile):
|
|
from_line = requirements.PipenvRequirement.from_line(line)
|
|
pipfile_pkgname = first([k for k in pipfile.keys()])
|
|
pipfile_entry = pipfile[pipfile_pkgname]
|
|
from_pipfile = requirements.PipenvRequirement.from_pipfile(pipfile_pkgname, [], pipfile_entry)
|
|
assert from_line.as_pipfile() == pipfile
|
|
assert from_pipfile.as_requirement() == line
|