Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: add network marker #649

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -43,6 +43,7 @@
}


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

Expand All @@ -66,6 +67,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