Files
pipenv/tests/test_pipenv.py
T
Tzu-ping Chung 92cc570588 Split up tests in test_pipenv
All tests are intact. I only move them around.

PipenvInstance is turned into a fixture to be used across files.
needs_internet is turned into a marker to be used across files.
2018-04-12 17:05:17 +08:00

60 lines
1.4 KiB
Python

"""Misc. tests that don't fit anywhere.
XXX: Try our best to reduce tests in this file.
"""
from pipenv.core import activate_virtualenv
import pytest
@pytest.mark.code
@pytest.mark.install
@pytest.mark.skip(reason='non deterministic')
def test_code_import_manual(PipenvInstance):
with PipenvInstance(chdir=True) as p:
with open('t.py', 'w') as f:
f.write('import requests')
p.pipenv('install -c .')
assert 'requests' in p.pipfile['packages']
@pytest.mark.code
@pytest.mark.virtualenv
@pytest.mark.project
def test_activate_virtualenv_no_source(project):
command = activate_virtualenv(source=False)
venv = project.virtualenv_location
assert command == '{0}/bin/activate'.format(venv)
@pytest.mark.lock
@pytest.mark.deploy
@pytest.mark.cli
def test_deploy_works(PipenvInstance, pypi):
with PipenvInstance(pypi=pypi) as p:
with open(p.pipfile_path, 'w') as f:
contents = """
[packages]
requests = "==2.14.0"
flask = "==0.12.2"
[dev-packages]
pytest = "==3.1.1"
""".strip()
f.write(contents)
c = p.pipenv('install')
assert c.return_code == 0
c = p.pipenv('lock')
assert c.return_code == 0
with open(p.pipfile_path, 'w') as f:
contents = """
[packages]
requests = "==2.14.0"
""".strip()
f.write(contents)
c = p.pipenv('install --deploy')
assert c.return_code > 0