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

CI: omit repeated slow tests #1131

Merged
merged 3 commits into from
Apr 23, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ norecursedirs = ["venv", ".tox", ".git", "node_modules"]
addopts = "--strict-markers"
markers = [
"requiresinternet: marks tests requiring an internet connection",
"slowtest: marks particularly slow tests that do not need to be run for every testenv variant",
]


Expand Down
1 change: 1 addition & 0 deletions tests/test_build_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def test_initialize_aborts_if_no_source(frontend_build_hook, mocker):

@pytest.mark.skipif(shutil.which("npm") is None, reason="npm not installed")
@pytest.mark.requiresinternet
@pytest.mark.slowtest
@pytest.mark.usefixtures("frontend_src")
def test_initialize_builds_frontend(frontend_build_hook, tmp_root):
frontend_build_hook.initialize("standard", build_data={})
Expand Down
1 change: 1 addition & 0 deletions tests/test_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def module(request):
return request.param


@pytest.mark.slowtest
def test_import(module):
python = sys.executable
assert run([python, "-c", f"import {module}"], check=False).returncode == 0
1 change: 1 addition & 0 deletions tests/test_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def test_VirtualEnv_addsitedir(nested_venv: VirtualEnv) -> None:


@pytest.mark.requiresinternet
@pytest.mark.slowtest
def test_VirtualEnv_run_pip_install(tmp_path: Path) -> None:
# XXX: slow test
venv = VirtualEnv(tmp_path)
Expand Down
1 change: 1 addition & 0 deletions tests/test_pluginsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ def test_path(self, dummy_plugin):
assert dummy_plugin.path == str(Path(__file__).parent)

@pytest.mark.requiresinternet
@pytest.mark.slowtest
@pytest.mark.usefixtures("save_sys_path")
def test_path_installed_plugin_is_none(self, scratch_project):
# XXX: this test is slow and fragile. (It won't run
Expand Down
2 changes: 1 addition & 1 deletion tests/test_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __call__(
# The FSEventObserver (used on macOS) seems to send events for things that
# happened before is was started. Here, we wait a little bit for things to
# start, then discard any pre-existing events.
time.sleep(0.1)
time.sleep(0.2)
watcher.wait(blocking=False)

yield self.watched_path
Expand Down
6 changes: 4 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ python =

[testenv]
commands =
coverage run -m pytest {posargs:tests -ra}
coverage run -m pytest {posargs:tests -ra --durations=20}
passenv = USERNAME
setenv =
# skip building frontend js/css
HATCH_BUILD_NO_HOOKS=true
# do not run marked slow tests in every variant testenv
{mistune0,noutils,pytz,tzdata}: PYTEST_ADDOPTS=-m "not slowtest"
deps =
pytest>=6
pytest-click
Expand Down Expand Up @@ -63,7 +65,7 @@ download = true
# break PATH in noutils environment(s).
allowlist_externals = env
commands =
env PATH="{env_bin_dir}" coverage run -m pytest {posargs:tests -ra}
env PATH="{env_bin_dir}" coverage run -m pytest {posargs:tests -ra --durations=20}

[testenv:lint]
use_develop = true
Expand Down