pip-download icon indicating copy to clipboard operation
pip-download copied to clipboard

Offline tests

Open jayvdb opened this issue 5 years ago • 2 comments

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

jayvdb avatar Dec 08 '19 07:12 jayvdb

thanks for tips! I will fix this soon or later.

youngquan avatar Dec 15 '19 14:12 youngquan

@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.

youngquan avatar Feb 12 '20 14:02 youngquan