Skip to content

Commit bdc8c47

Browse files
committed
test(discover): gate version-specific diagnostics tests on RF 7.0+
The diagnostics-summary tests in discover/test_errors.py assert on the singular-header deprecation warning and arg-spec parse diagnostics, both of which Robot Framework only emits from 7.0 onward. On RF 5.0/6.0/6.1 they don't exist, so the tests failed across all OS/Python combinations. Skip them on RF < 7.0 via a needs_rf_70 marker. Move that marker (and needs_rf_72) into a shared runner/cli/rf_markers.py so results/ and discover/ reference a single definition instead of redeclaring it.
1 parent 9d84f58 commit bdc8c47

4 files changed

Lines changed: 25 additions & 15 deletions

File tree

tests/robotcode/runner/cli/discover/test_errors.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import json
99
from pathlib import Path
1010

11+
from ..rf_markers import needs_rf_70
1112
from .conftest import CliRunner
1213

1314

@@ -58,6 +59,7 @@ def test_parse_warnings_dont_fail_the_command(robotcode_cli: CliRunner, parse_er
5859
assert data.get("diagnostics"), "expected non-empty diagnostics"
5960

6061

62+
@needs_rf_70
6163
def test_text_default_shows_diagnostics_summary_only(text_discover: CliRunner, parse_error_suite: Path) -> None:
6264
"""By default a compact `## Diagnostics` counts section follows the
6365
statistics (a separate block, not folded into them) plus a pointer to
@@ -82,6 +84,7 @@ def test_text_clean_suite_has_no_diagnostics_section(text_discover: CliRunner, f
8284
assert "--diagnostics" not in result.stdout
8385

8486

87+
@needs_rf_70
8588
def test_text_diagnostics_flag_shows_full_block_before_listing(
8689
text_discover: CliRunner, parse_error_suite: Path
8790
) -> None:
@@ -100,6 +103,7 @@ def test_text_diagnostics_flag_shows_full_block_before_listing(
100103
assert str(parse_error_suite) not in result.stdout
101104

102105

106+
@needs_rf_70
103107
def test_text_error_severity_in_diagnostics(robotcode_cli: CliRunner, tmp_path: Path) -> None:
104108
"""An error-level parse problem (here an invalid argument spec) shows an
105109
`Errors` row in the counts section and an `_(error)_` label in the full

tests/robotcode/runner/cli/results/conftest.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,6 @@
3838
SUITES_DIR = Path(__file__).parent / "suites"
3939

4040

41-
# ---------------------------------------------------------------------------
42-
# RF-version markers
43-
# ---------------------------------------------------------------------------
44-
45-
needs_rf_70 = pytest.mark.skipif(
46-
RF_VERSION < (7, 0),
47-
reason="requires Robot Framework 7.0+ (VAR, JSON output, attribute renames)",
48-
)
49-
needs_rf_72 = pytest.mark.skipif(
50-
RF_VERSION < (7, 2),
51-
reason="requires Robot Framework 7.2+ (GROUP block)",
52-
)
53-
54-
5541
# ---------------------------------------------------------------------------
5642
# Subprocess wiring
5743
# ---------------------------------------------------------------------------

tests/robotcode/runner/cli/results/test_log.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313

1414
import pytest
1515

16+
from ..rf_markers import needs_rf_70, needs_rf_72
1617
from ._helpers import count_entries_of_type, find_test, iter_body, strip_ansi
17-
from .conftest import CliRunner, JsonRunner, needs_rf_70, needs_rf_72
18+
from .conftest import CliRunner, JsonRunner
1819

1920
# ---------------------------------------------------------------------------
2021
# Helpers local to this file
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""Shared Robot-Framework-version skip markers for the `runner/cli` tests.
2+
3+
Single source of truth so sibling packages (`results`, `discover`, ...)
4+
don't each redefine the same `skipif` condition.
5+
"""
6+
7+
import pytest
8+
9+
from robotcode.robot.utils import RF_VERSION
10+
11+
needs_rf_70 = pytest.mark.skipif(
12+
RF_VERSION < (7, 0),
13+
reason="requires Robot Framework 7.0+ (VAR, JSON output, attribute renames, "
14+
"singular-header deprecation warning, arg-spec parse diagnostics)",
15+
)
16+
needs_rf_72 = pytest.mark.skipif(
17+
RF_VERSION < (7, 2),
18+
reason="requires Robot Framework 7.2+ (GROUP block)",
19+
)

0 commit comments

Comments
 (0)