Skip to content
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
8 changes: 7 additions & 1 deletion tests/ci_runnable.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
`AgentStart`) or calls a host that can be reached and is not local, when the baseline does not
name it; and a baseline entry that no longer is one. The test's own body is read, and so are the
non-test functions of its module that it names as a fixture or calls, transitively; a cause in
another module is not seen. The walk, the baseline format and the report are `wide_scans`'s.
another module is not seen. A module whose text does not contain `integration` is not parsed.
The walk, the baseline format and the report are `wide_scans`'s.
"""

from __future__ import annotations
Expand Down Expand Up @@ -157,6 +158,11 @@ def _reached(test: Function, tree: ast.Module) -> list[ast.AST]:


def _violators(text: str, required_fields: Mapping[str, frozenset[str]]) -> dict[str, str]:
# A module that does not name the selector has no test the guard checks, and skipping it
# keeps the walk of the whole tree inside the time limit, as `SCAN_TEXT` does for the
# wide-scans guard.
if "integration" not in text:
return {}
tree = ast.parse(text)
found: dict[str, str] = {}
for test, marked in walk_tests(tree, _marks_integration):
Expand Down
2 changes: 2 additions & 0 deletions tests/drift/test_no_thread_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import pytest

from tests.time_limit import LOADED_TEST_TIME_LIMIT
from tests.tracked_files import ROOT, guarded_files

PIPELINE_CLI = ROOT / "src/agent_build_kit/cli/pipeline.py"
Expand Down Expand Up @@ -40,6 +41,7 @@ def names_in(path: Path) -> list[str]:
return found


@pytest.mark.time_limit(LOADED_TEST_TIME_LIMIT)
@pytest.mark.integration
def test_no_source_file_defines_or_uses_a_pass_rule_or_the_loaded_tick_marker() -> None:
sources = guarded_files(under=["src"], suffixes={".py"})
Expand Down
2 changes: 2 additions & 0 deletions tests/test_ci_runnable_guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import pytest

from tests.ci_runnable import check_tests, load_baseline, required_settings_fields
from tests.time_limit import LOADED_TEST_TIME_LIMIT

NONE: frozenset[str] = frozenset()
REQUIRED = {"Settings": frozenset({"api_token"})}
Expand Down Expand Up @@ -168,6 +169,7 @@ def test_a_baseline_entry_that_is_no_longer_a_violator_is_reported_as_stale(
assert "stale" in problems[0]


@pytest.mark.time_limit(LOADED_TEST_TIME_LIMIT)
@pytest.mark.integration
def test_no_integration_test_of_the_kit_needs_more_than_ci_has() -> None:
problems = check_tests(baseline=load_baseline(), required_fields=required_settings_fields())
Expand Down
2 changes: 2 additions & 0 deletions tests/test_live_tag_drift.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from tests.live_tag_drift import INTEGRATION, find_live_modules
from tests.runtime_tag_collection import ROOT
from tests.time_limit import LOADED_TEST_TIME_LIMIT

# One module per way a test is marked `e2e`.
MARKS = {
Expand Down Expand Up @@ -87,6 +88,7 @@ def test_a_file_listed_and_gone_before_it_is_read_is_skipped(tmp_path: Path) ->
assert find_live_modules(tmp_path / "tests") == [live]


@pytest.mark.time_limit(LOADED_TEST_TIME_LIMIT)
@pytest.mark.integration
def test_every_module_the_old_glob_and_text_match_found_is_still_found() -> None:
old = [
Expand Down
2 changes: 2 additions & 0 deletions tests/test_secret_leak_guards.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from agent_build_kit import settings as settings_module
from agent_build_kit.settings import Settings
from tests.time_limit import LOADED_TEST_TIME_LIMIT

TESTS = Path(__file__).parent
SAMPLE = "sample-env-value-0001"
Expand Down Expand Up @@ -55,6 +56,7 @@ def _prints_its_environment(model: str) -> bool:
return SAMPLE in repr(cast(Any, cls).model_construct(**{field: {"KEY": SAMPLE}}))


@pytest.mark.time_limit(LOADED_TEST_TIME_LIMIT)
@pytest.mark.integration
def test_no_test_support_model_prints_its_environment() -> None:
"""The models are found when the test runs, not when the module is imported."""
Expand Down
1 change: 1 addition & 0 deletions tests/test_wide_scans_are_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ def test_the_default_run_still_collects_the_logic_tests_of_a_check(
assert default_run_collects(pytester, module)


@pytest.mark.time_limit(LOADED_TEST_TIME_LIMIT)
@pytest.mark.integration
def test_no_test_of_the_repository_scans_it_without_the_integration_selector() -> None:
assert check_tests(TESTS_ROOT, baseline=load_baseline()) == []