mirror of
https://github.com/openglow-org/forgefirm.git
synced 2026-09-27 08:41:13 -07:00
forgetest: non-behavioral paths outside every fingerprint; hollow covers fail the lint
The coverage lint already allowed docs, CI, unit tests and licenses to go uncovered; the same list now keeps them out of every fingerprint, so a README edit in any component re-requires nothing. The list moves to the manifest module as NON_BEHAVIORAL, the one place both uses read it. And a coverage entry that selects no file of its component (a glob without the recipe's subdirectory, a component the manifest lacks, a glob naming docs only) fails the lint: such an entry covers nothing and the test's fingerprint ignores the file it meant. The contract says both. Every test whose maps reached a doc or a test file gets a new fingerprint once.
This commit is contained in:
@@ -115,6 +115,31 @@ class CoverageReportTests(unittest.TestCase):
|
||||
self.assertNotIn("forgetest", m.coverage_report(man, [], allow=[]),
|
||||
"dev-only components are outside the report")
|
||||
|
||||
def test_non_behavioral_paths_are_outside_every_fingerprint(self):
|
||||
man = helpers.make_manifest()
|
||||
t = helpers.make_test("a.one", [("forgectrl", "**")])
|
||||
a = m.fingerprint(man, t.covers)
|
||||
for comp, path in (("forgectrl", "README.md"), ("forgectrl", "docs/SERVICES.md"),
|
||||
("forgectrl", "tests/test_x.py"), ("forgectrl", ".github/workflows/ci.yml")):
|
||||
self.assertEqual(a, m.fingerprint(helpers.with_file(man, comp, path, "changed"), t.covers),
|
||||
path)
|
||||
self.assertNotEqual(a, m.fingerprint(helpers.with_file(man, "forgectrl", "src/ui.c", "changed"),
|
||||
t.covers))
|
||||
self.assertTrue(m.non_behavioral("forgectrl", "tools/devserver.py"))
|
||||
self.assertFalse(m.non_behavioral("grblhal-glowforge", "tools/devserver.py"))
|
||||
|
||||
def test_an_entry_that_selects_nothing_is_reported(self):
|
||||
man = helpers.make_manifest()
|
||||
good = helpers.make_test("a.one", [("forgectrl", "src/ui.c")])
|
||||
# the recipe's subdirectory left out of the glob, and an unknown component
|
||||
bad = helpers.make_test("a.two", [("forgectrl", "ui.c"), ("no-such", "**")])
|
||||
self.assertEqual(m.empty_covers(man, [good]), [])
|
||||
self.assertEqual(m.empty_covers(man, [good, bad]),
|
||||
[("a.two", "forgectrl", "ui.c"), ("a.two", "no-such", "**")])
|
||||
# a glob that selects docs only names nothing any fingerprint carries
|
||||
docs = helpers.make_test("a.three", [("forgectrl", "**/*.md")])
|
||||
self.assertEqual(m.empty_covers(man, [docs]), [("a.three", "forgectrl", "**/*.md")])
|
||||
|
||||
|
||||
class CatalogTests(unittest.TestCase):
|
||||
def test_catalog_hash_is_definition_only(self):
|
||||
|
||||
Reference in New Issue
Block a user