mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-12-02 18:36:28 +01:00
test: stop on a disabled pytest cache, keep tests independent of the host
Additional changes - Pin the cgroup CPU limit in the worker count test. - Delete the generated _autosummary folders before the Sphinx build; the pattern missed them. - Describe how to run pytest in the python-environment skill. - Set the clock of the full-charge deadline tests in Europe/Berlin; they failed on hosts with another DST change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Assisted-by: Claude Code (claude-opus-5-5)
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
b3d5334d3e
commit
f784773e46
@@ -88,3 +88,36 @@ class TestServerMarker:
|
||||
assert item.get_closest_marker("eos_server") is not None, item.nodeid
|
||||
group = item.get_closest_marker("xdist_group")
|
||||
assert group is not None and group.args == ("eos_server",), item.nodeid
|
||||
|
||||
|
||||
def fake_config(**attributes: Any) -> pytest.Config:
|
||||
"""A stand-in for the pytest configuration with the given attributes, e.g. ``cache``."""
|
||||
return type("Config", (), attributes)()
|
||||
|
||||
|
||||
class TestServerTestsNeedTheCache:
|
||||
"""pytest-xprocess keeps its state in the pytest cache; without it every server test errors."""
|
||||
|
||||
def test_server_tests_without_cache_stop_the_run(self) -> None:
|
||||
"""``-p no:cacheprovider`` turns into one clear usage error, not 19 cryptic ones."""
|
||||
with pytest.raises(pytest.UsageError, match="no:cacheprovider"):
|
||||
conftest.require_cache_for_server_tests(fake_config(), [FakeItem("xprocess")]) # type: ignore[list-item]
|
||||
|
||||
def test_server_tests_with_cache_run(self) -> None:
|
||||
"""With the cache, server tests run as usual."""
|
||||
config = fake_config(cache=object())
|
||||
conftest.require_cache_for_server_tests(config, [FakeItem("xprocess")]) # type: ignore[list-item]
|
||||
conftest.fail_server_test_without_cache(config, FakeItem("xprocess")) # type: ignore[arg-type]
|
||||
|
||||
def test_other_tests_run_without_cache(self) -> None:
|
||||
"""Tests that start no server do not need the cache."""
|
||||
config = fake_config()
|
||||
conftest.require_cache_for_server_tests(config, [FakeItem("tmp_path")]) # type: ignore[list-item]
|
||||
conftest.fail_server_test_without_cache(config, FakeItem("tmp_path")) # type: ignore[arg-type]
|
||||
|
||||
def test_xdist_worker_fails_each_server_test_with_the_cause(self) -> None:
|
||||
"""A worker cannot report a usage error, so each server test fails with the message."""
|
||||
config = fake_config(workerinput={})
|
||||
conftest.require_cache_for_server_tests(config, [FakeItem("xprocess")]) # type: ignore[list-item]
|
||||
with pytest.raises(pytest.fail.Exception, match="no:cacheprovider"):
|
||||
conftest.fail_server_test_without_cache(config, FakeItem("xprocess")) # type: ignore[arg-type]
|
||||
|
||||
Reference in New Issue
Block a user