Skip to content

Commit

Permalink
tests: add network marker
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii authored and gaborbernat committed Aug 3, 2023
1 parent 9aae9a2 commit 381ce78
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ norecursedirs = "tests/integration/*"
markers = [
"isolated",
"pypy3323bug",
"network",
]
filterwarnings = [
"error",
Expand Down
30 changes: 16 additions & 14 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def test_build_raises_build_backend_exception(mocker, package_test_flit):
build.__main__.build_package(package_test_flit, '.', ['sdist'])


@pytest.mark.network
@pytest.mark.pypy3323bug
def test_build_package(tmp_dir, package_test_setuptools):
build.__main__.build_package(package_test_setuptools, tmp_dir, ['sdist', 'wheel'])
Expand All @@ -198,6 +199,7 @@ def test_build_package(tmp_dir, package_test_setuptools):
]


@pytest.mark.network
@pytest.mark.pypy3323bug
def test_build_package_via_sdist(tmp_dir, package_test_setuptools):
build.__main__.build_package_via_sdist(package_test_setuptools, tmp_dir, ['wheel'])
Expand All @@ -223,7 +225,7 @@ def test_build_package_via_sdist_invalid_distribution(tmp_dir, package_test_setu
@pytest.mark.parametrize(
('args', 'output'),
[
(
pytest.param(
[],
[
'* Creating venv isolated environment...',
Expand All @@ -238,8 +240,10 @@ def test_build_package_via_sdist_invalid_distribution(tmp_dir, package_test_setu
'* Building wheel...',
'Successfully built test_setuptools-1.0.0.tar.gz and test_setuptools-1.0.0-py2.py3-none-any.whl',
],
id='via-sdist-isolation',
marks=[pytest.mark.network, pytest.mark.isolated],
),
(
pytest.param(
['--no-isolation'],
[
'* Getting build dependencies for sdist...',
Expand All @@ -249,8 +253,9 @@ def test_build_package_via_sdist_invalid_distribution(tmp_dir, package_test_setu
'* Building wheel...',
'Successfully built test_setuptools-1.0.0.tar.gz and test_setuptools-1.0.0-py2.py3-none-any.whl',
],
id='via-sdist-no-isolation',
),
(
pytest.param(
['--wheel'],
[
'* Creating venv isolated environment...',
Expand All @@ -260,24 +265,28 @@ def test_build_package_via_sdist_invalid_distribution(tmp_dir, package_test_setu
'* Building wheel...',
'Successfully built test_setuptools-1.0.0-py2.py3-none-any.whl',
],
id='wheel-direct-isolation',
marks=[pytest.mark.network, pytest.mark.isolated],
),
(
pytest.param(
['--wheel', '--no-isolation'],
[
'* Getting build dependencies for wheel...',
'* Building wheel...',
'Successfully built test_setuptools-1.0.0-py2.py3-none-any.whl',
],
id='wheel-direct-no-isolation',
),
(
pytest.param(
['--sdist', '--no-isolation'],
[
'* Getting build dependencies for sdist...',
'* Building sdist...',
'Successfully built test_setuptools-1.0.0.tar.gz',
],
id='sdist-direct-no-isolation',
),
(
pytest.param(
['--sdist', '--wheel', '--no-isolation'],
[
'* Getting build dependencies for sdist...',
Expand All @@ -286,16 +295,9 @@ def test_build_package_via_sdist_invalid_distribution(tmp_dir, package_test_setu
'* Building wheel...',
'Successfully built test_setuptools-1.0.0.tar.gz and test_setuptools-1.0.0-py2.py3-none-any.whl',
],
id='sdist-and-wheel-direct-no-isolation',
),
],
ids=[
'via-sdist-isolation',
'via-sdist-no-isolation',
'wheel-direct-isolation',
'wheel-direct-no-isolation',
'sdist-direct-no-isolation',
'sdist-and-wheel-direct-no-isolation',
],
)
@pytest.mark.flaky(reruns=5)
def test_output(package_test_setuptools, tmp_dir, capsys, args, output):
Expand Down
2 changes: 2 additions & 0 deletions tests/test_self_packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
}


@pytest.mark.network
def test_build_sdist(monkeypatch, tmpdir):
monkeypatch.chdir(MAIN_DIR)

Expand All @@ -68,6 +69,7 @@ def test_build_sdist(monkeypatch, tmpdir):
assert simpler == sdist_files


@pytest.mark.network
@pytest.mark.parametrize('args', ((), ('--wheel',)), ids=('from_sdist', 'direct'))
def test_build_wheel(monkeypatch, tmpdir, args):
monkeypatch.chdir(MAIN_DIR)
Expand Down
4 changes: 3 additions & 1 deletion tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@


@pytest.mark.pypy3323bug
@pytest.mark.parametrize('isolated', [False, True])
@pytest.mark.parametrize('isolated', [False, pytest.param(True, marks=[pytest.mark.network, pytest.mark.isolated])])
def test_wheel_metadata(package_test_setuptools, isolated):
metadata = build.util.project_wheel_metadata(package_test_setuptools, isolated)

assert metadata['name'] == 'test-setuptools'
assert metadata['version'] == '1.0.0'


@pytest.mark.network
@pytest.mark.pypy3323bug
def test_wheel_metadata_isolation(package_test_flit):
if importlib.util.find_spec('flit_core'):
Expand All @@ -33,6 +34,7 @@ def test_wheel_metadata_isolation(package_test_flit):
build.util.project_wheel_metadata(package_test_flit, isolated=False)


@pytest.mark.network
@pytest.mark.pypy3323bug
def test_with_get_requires(package_test_metadata):
metadata = build.util.project_wheel_metadata(package_test_metadata)
Expand Down

0 comments on commit 381ce78

Please sign in to comment.