Fix brand lint tests, run tests in CI
All checks were successful
/ build (push) Successful in 1m36s
/ accessibility (push) Successful in 3m16s

Two tests used the correct spelling "Hackertours" where they meant a
wrong one, so they expected errors the lint rightly doesn't report
("Hackertours" should be "Hackertours"). Use "HackerTours" there.

CI now runs the tests before building the site.
This commit is contained in:
Stefan Bethke 2026-11-14 00:33:10 +01:00
commit b644e8dce2
2 changed files with 13 additions and 8 deletions

View file

@ -32,6 +32,11 @@ jobs:
fetch-depth: 0 # pull full history for page lastmod by git commit date
submodules: recursive
- name: Run tests
run: |
apk add python3
python3 -m unittest discover -s tests -v
- name: Patch baseURL (staging only)
if: github.ref_name != 'main'
run: |

View file

@ -31,18 +31,18 @@ class BrandLintTest(unittest.TestCase):
)
def test_errors_include_spelling_and_source_line(self):
result = self.build("---\ntitle: Hackertours\n---\nHACKERTOURS and hackertours\n")
result = self.build("---\ntitle: HackerTours\n---\nHACKERTOURS and hackertours\n")
self.assertNotEqual(result.returncode, 0)
for line, spelling in [(2, "Hackertours"), (4, "HACKERTOURS"), (4, "hackertours")]:
for line, spelling in [(2, "HackerTours"), (4, "HACKERTOURS"), (4, "hackertours")]:
self.assertIn(f':{line}: "{spelling}" should be "Hackertours"', result.stderr)
def test_valid_names_identifiers_and_explicit_exceptions(self):
result = self.build(
"---\n"
"title: Hackertours # hackertours-lint-ignore\n"
"title: HackerTours # hackertours-lint-ignore\n"
"---\n"
"Hackertours\n"
"Hackertours <!-- hackertours-lint-ignore -->\n"
"HackerTours <!-- hackertours-lint-ignore -->\n"
"[Shop](https://hackertours.example/hackertours) "
"ticket@hackertours.example @hackertours "
"#easterhegg-hackertours:example.org\n"
@ -52,12 +52,12 @@ class BrandLintTest(unittest.TestCase):
def test_marker_only_ignores_its_own_line(self):
result = self.build(
"---\ntitle: Hackertours\n---\n"
"Hackertours <!-- hackertours-lint-ignore -->\n"
"Hackertours\n"
"HackerTours <!-- hackertours-lint-ignore -->\n"
"HackerTours\n"
)
self.assertNotEqual(result.returncode, 0)
self.assertIn(':5: "Hackertours" should be "Hackertours"', result.stderr)
self.assertNotIn(':4: "Hackertours" should be "Hackertours"', result.stderr)
self.assertIn(':5: "HackerTours" should be "Hackertours"', result.stderr)
self.assertNotIn(':4: "HackerTours" should be "Hackertours"', result.stderr)
if __name__ == "__main__":