pip-download
pip-download copied to clipboard
Offline tests
Distro packaging process typically runs smoke tests in an isolated VM, disconnected from the internet.
This type of test can be achieved by mocking (difficult with pip) or using an offline PyPI index.
There are a few, devpi
being the 'best', and has a pytest plugin.
https://github.com/uranusjr/pytest-pypi-gateway looks like it might be usable, and the author is part of the pipenv team.
pipenv has its own pypi flask-based pytest fixture
thanks for tips! I will fix this soon or later.
@jayvdb hello, I am trying to fix this issue recently. I have noticed that in pip's test, there are codes like below:
@pytest.mark.network
def test_basic_download_setuptools(script):
"""
It should download (in the scratch path) and not install if requested.
"""
result = script.pip('download', 'setuptools')
setuptools_prefix = str(Path('scratch') / 'setuptools')
assert any(
path.startswith(setuptools_prefix) for path in result.files_created
)
@pytest.mark.network
is used to mark whether this test needs network. So you say that "Distro packaging process typically runs smoke tests in an isolated VM, disconnected from the internet.", is this correct? Can I use network for some tests? Looking forwoad to you reply.