Adapt test cases to prefer the mocked PyPI.

This commit is contained in:
frostming
2020-09-01 16:35:37 +08:00
parent 1a26eb0789
commit 8c959096a8
6 changed files with 14 additions and 9 deletions
+1
View File
@@ -0,0 +1 @@
Adapt test cases to prefer the mocked PyPI.
+2 -2
View File
@@ -164,7 +164,7 @@ def test_pipenv_clean_pip_no_warnings(PipenvInstance):
f.write('from setuptools import setup; setup(name="empty")')
c = p.pipenv('install -e .')
assert c.return_code == 0
c = p.pipenv('run pip install pytz')
c = p.pipenv('run pip install -i {} pytz'.format(p.index_url))
assert c.return_code == 0
c = p.pipenv('clean')
assert c.return_code == 0
@@ -178,7 +178,7 @@ def test_pipenv_clean_pip_warnings(PipenvInstance):
f.write('from setuptools import setup; setup(name="empty")')
# create a fake git repo to trigger a pip freeze warning
os.mkdir('.git')
c = p.pipenv("run pip install -e .")
c = p.pipenv("run pip install -i {} -e .".format(p.index_url))
assert c.return_code == 0
c = p.pipenv('clean')
assert c.return_code == 0
@@ -158,6 +158,7 @@ def test_resolver_unique_markers(PipenvInstance):
@flaky
@pytest.mark.project
@pytest.mark.needs_internet
def test_environment_variable_value_does_not_change_hash(PipenvInstance):
with PipenvInstance(chdir=True) as p:
with temp_environ():
+4 -4
View File
@@ -622,11 +622,11 @@ def test_lock_with_incomplete_source(PipenvInstance):
with open(p.pipfile_path, 'w') as f:
f.write("""
[[source]]
url = "https://test.pypi.org/simple"
url = "{}"
[packages]
requests = "*"
""")
""".format(p.index_url))
c = p.pipenv('install --skip-lock')
assert c.return_code == 0
c = p.pipenv('install')
@@ -697,13 +697,13 @@ def test_lock_after_update_source_name(PipenvInstance):
with PipenvInstance(chdir=True) as p:
contents = """
[[source]]
url = "https://test.pypi.org/simple"
url = "{}"
verify_ssl = true
name = "test"
[packages]
six = "*"
""".strip()
""".format(p.index_url).strip()
with open(p.pipfile_path, 'w') as f:
f.write(contents)
c = p.pipenv("lock")
+5 -2
View File
@@ -121,6 +121,7 @@ def test_maintain_file_line_endings(PipenvInstance, newlines):
@pytest.mark.project
@pytest.mark.sources
@pytest.mark.needs_internet
def test_many_indexes(PipenvInstance):
with PipenvInstance(chdir=True) as p:
with open(p.pipfile_path, 'w') as f:
@@ -184,13 +185,15 @@ def test_run_in_virtualenv_with_global_context(PipenvInstance, virtualenv):
project.virtualenv_location, virtualenv.as_posix()
)
c = delegator_run(
"pipenv run pip install click", cwd=os.path.abspath(p.path),
"pipenv run pip install -i {} click".format(p.index_url),
cwd=os.path.abspath(p.path),
env=os.environ.copy()
)
assert c.return_code == 0, (c.out, c.err)
assert "Courtesy Notice" in c.err, (c.out, c.err)
c = delegator_run(
"pipenv install six", cwd=os.path.abspath(p.path), env=os.environ.copy()
"pipenv install -i {} six".format(p.index_url),
cwd=os.path.abspath(p.path), env=os.environ.copy()
)
assert c.return_code == 0, (c.out, c.err)
c = delegator_run(
+1 -1
View File
@@ -75,7 +75,7 @@ def test_pipenv_clean_windows(PipenvInstance):
with PipenvInstance(chdir=True) as p:
c = p.pipenv('install requests')
assert c.return_code == 0
c = p.pipenv('run pip install click')
c = p.pipenv('run pip install -i {} click'.format(p.index_url))
assert c.return_code == 0
c = p.pipenv('clean --dry-run')