mcward-cli 1.2.0__tar.gz → 1.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/PKG-INFO +1 -1
  2. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/src/mcward/cli/commands/test.py +1 -1
  3. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/src/mcward/cli/reports/__init__.py +18 -1
  4. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/src/mcward/cli/reports/html.py +1 -1
  5. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/tests/test_reports.py +19 -0
  6. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/.gitignore +0 -0
  7. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/README.md +0 -0
  8. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/pyproject.toml +0 -0
  9. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/src/mcward/cli/__init__.py +0 -0
  10. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/src/mcward/cli/commands/__init__.py +0 -0
  11. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/src/mcward/cli/commands/daemon.py +0 -0
  12. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/src/mcward/cli/commands/install.py +0 -0
  13. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/src/mcward/cli/commands/list.py +0 -0
  14. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/src/mcward/cli/datapacks.py +0 -0
  15. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/src/mcward/cli/environments.py +0 -0
  16. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/src/mcward/cli/reporters/__init__.py +0 -0
  17. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/src/mcward/cli/reporters/coverage.py +0 -0
  18. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/src/mcward/cli/reporters/github.py +0 -0
  19. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/src/mcward/cli/reporters/live.py +0 -0
  20. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/src/mcward/cli/reports/junit.py +0 -0
  21. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/src/mcward/cli/reports/lcov.py +0 -0
  22. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/src/mcward/cli/ui.py +0 -0
  23. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/tests/test_cli.py +0 -0
  24. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/tests/test_coverage_report.py +0 -0
  25. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/tests/test_discovery.py +0 -0
  26. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/tests/test_environments.py +0 -0
  27. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/tests/test_github.py +0 -0
  28. {mcward_cli-1.2.0 → mcward_cli-1.2.1}/tests/test_live.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: mcward-cli
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary: Command-line interface for Ward, a testing framework for Minecraft datapacks using mcfunction.
5
5
  Author-email: Aksiome <54895777+aksiome@users.noreply.github.com>
6
6
  License: MPL-2.0
@@ -94,7 +94,7 @@ def test(
94
94
  envs = start_environments([manager.get(v) for v in selected])
95
95
  console.print()
96
96
  session = run(paths, envs, selector, coverage=enabled, verbose=verbose)
97
- report_session(session, paths, specs, junit_xml, verbose, selector, ignores)
97
+ report_session(session, paths, specs, junit_xml, verbose, selector, ignores, enabled)
98
98
  if session.failed:
99
99
  sys.exit(1)
100
100
  except WardError as e:
@@ -8,12 +8,13 @@ import rich_click as click
8
8
  from mcward import CoverageIgnores, ResolvedCoverage, TestSession, Version, resolve_coverage
9
9
 
10
10
  from ..reporters.coverage import render_coverage
11
- from ..ui import console
11
+ from ..ui import console, print_warning
12
12
  from .html import write_html
13
13
  from .junit import write_junit
14
14
  from .lcov import write_lcov
15
15
 
16
16
  __all__ = [
17
+ "missing_coverage",
17
18
  "parse_coverage_report",
18
19
  "report_session",
19
20
  "write_coverage_reports",
@@ -42,11 +43,18 @@ def report_session(
42
43
  verbose: bool = False,
43
44
  selector: str = "*:*",
44
45
  ignores: CoverageIgnores | None = None,
46
+ coverage: bool = False,
45
47
  ) -> None:
46
48
  """Render the coverage summary and write the requested report files."""
47
49
  if junit_xml is not None:
48
50
  write_junit(session, junit_xml)
49
51
  console.print(f"Test results written to [magenta]{junit_xml}[/magenta]")
52
+ if coverage:
53
+ for version in missing_coverage(session):
54
+ print_warning(
55
+ f"No coverage reported by {version.name}: its ward mod predates coverage, "
56
+ "reinstall the environment once a newer release supports this Minecraft version"
57
+ )
50
58
  if session.coverage:
51
59
  resolved = {
52
60
  version: resolve_coverage(coverage, datapacks, selector, ignores)
@@ -62,6 +70,15 @@ def report_session(
62
70
  console.print(f"[dim]{hint}[/dim]")
63
71
 
64
72
 
73
+ def missing_coverage(session: TestSession) -> list[Version]:
74
+ """Versions whose run completed without a coverage event."""
75
+ return [
76
+ version
77
+ for version in session.versions
78
+ if version not in session.coverage and version not in session.aborted
79
+ ]
80
+
81
+
65
82
  def write_coverage_reports(
66
83
  session: TestSession,
67
84
  resolved: Mapping[Version, ResolvedCoverage],
@@ -74,7 +74,7 @@ input { margin: 1rem 0 .5rem; padding: .4rem; width: 20rem; }
74
74
  summary { cursor: pointer; list-style: none; }
75
75
  summary::-webkit-details-marker { display: none; }
76
76
  .group { border: 1px solid var(--border); border-radius: 6px; margin: .5rem 0; }
77
- .group > summary { display: grid; grid-template-columns: 1fr 8rem 3fr 3.5rem; gap: 1rem;
77
+ .group > summary { display: grid; grid-template-columns: 1fr 8rem 2fr 3.5rem; gap: 1rem;
78
78
  align-items: center; padding: .5rem .75rem; }
79
79
  .group > summary b { font-family: monospace; }
80
80
  .group > summary b::before { content: "\\25B8 "; color: var(--muted); }
@@ -17,6 +17,7 @@ from mcward._protocol import (
17
17
  )
18
18
  from mcward._runner import TestSession as Session
19
19
  from mcward.cli.reports import (
20
+ missing_coverage,
20
21
  parse_coverage_report,
21
22
  write_coverage_reports,
22
23
  write_junit,
@@ -27,6 +28,24 @@ V1 = Version.parse("26.1.2")
27
28
  V2 = Version.parse("26.1.1")
28
29
 
29
30
 
31
+ class TestMissingCoverage:
32
+ """Test spotting versions whose mod ignored the coverage flag."""
33
+
34
+ def test_version_that_never_reported_is_missing(self) -> None:
35
+ """An older mod runs the tests fine and never sends the event."""
36
+ session = Session([V1, V2])
37
+ session._dispatch(V1, Coverage(functions={}))
38
+
39
+ assert missing_coverage(session) == [V2]
40
+
41
+ def test_aborted_version_is_not_blamed_on_the_mod(self) -> None:
42
+ session = Session([V1, V2])
43
+ session._dispatch(V1, Coverage(functions={}))
44
+ session._dispatch(V2, StreamError("boom"))
45
+
46
+ assert missing_coverage(session) == []
47
+
48
+
30
49
  def resolved(session: Session, pack: Path) -> dict[Version, ResolvedCoverage]:
31
50
  return {v: resolve_coverage(coverage, [pack]) for v, coverage in session.coverage.items()}
32
51
 
File without changes
File without changes
File without changes
File without changes