diff --git a/news/3630.trivial.rst b/news/3630.trivial.rst new file mode 100644 index 00000000..a5d0d6c1 --- /dev/null +++ b/news/3630.trivial.rst @@ -0,0 +1 @@ +Adapt test cases to prefer the mocked PyPI. diff --git a/tests/integration/test_cli.py b/tests/integration/test_cli.py index 04253fc5..711f8daa 100644 --- a/tests/integration/test_cli.py +++ b/tests/integration/test_cli.py @@ -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 diff --git a/tests/integration/test_install_markers.py b/tests/integration/test_install_markers.py index 84237eb5..a0c3a279 100644 --- a/tests/integration/test_install_markers.py +++ b/tests/integration/test_install_markers.py @@ -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(): diff --git a/tests/integration/test_lock.py b/tests/integration/test_lock.py index 48232e60..2f7e0bd0 100644 --- a/tests/integration/test_lock.py +++ b/tests/integration/test_lock.py @@ -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") diff --git a/tests/integration/test_project.py b/tests/integration/test_project.py index ad38d74a..dac05d34 100644 --- a/tests/integration/test_project.py +++ b/tests/integration/test_project.py @@ -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( diff --git a/tests/integration/test_windows.py b/tests/integration/test_windows.py index 7355bbd0..43efaef1 100644 --- a/tests/integration/test_windows.py +++ b/tests/integration/test_windows.py @@ -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')