Fix brand lint tests, run tests in CI
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:
parent
f091f181b8
commit
b644e8dce2
2 changed files with 13 additions and 8 deletions
|
|
@ -32,6 +32,11 @@ jobs:
|
||||||
fetch-depth: 0 # pull full history for page lastmod by git commit date
|
fetch-depth: 0 # pull full history for page lastmod by git commit date
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
apk add python3
|
||||||
|
python3 -m unittest discover -s tests -v
|
||||||
|
|
||||||
- name: Patch baseURL (staging only)
|
- name: Patch baseURL (staging only)
|
||||||
if: github.ref_name != 'main'
|
if: github.ref_name != 'main'
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
|
|
@ -31,18 +31,18 @@ class BrandLintTest(unittest.TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_errors_include_spelling_and_source_line(self):
|
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)
|
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)
|
self.assertIn(f':{line}: "{spelling}" should be "Hackertours"', result.stderr)
|
||||||
|
|
||||||
def test_valid_names_identifiers_and_explicit_exceptions(self):
|
def test_valid_names_identifiers_and_explicit_exceptions(self):
|
||||||
result = self.build(
|
result = self.build(
|
||||||
"---\n"
|
"---\n"
|
||||||
"title: Hackertours # hackertours-lint-ignore\n"
|
"title: HackerTours # hackertours-lint-ignore\n"
|
||||||
"---\n"
|
"---\n"
|
||||||
"Hackertours\n"
|
"Hackertours\n"
|
||||||
"Hackertours <!-- hackertours-lint-ignore -->\n"
|
"HackerTours <!-- hackertours-lint-ignore -->\n"
|
||||||
"[Shop](https://hackertours.example/hackertours) "
|
"[Shop](https://hackertours.example/hackertours) "
|
||||||
"ticket@hackertours.example @hackertours "
|
"ticket@hackertours.example @hackertours "
|
||||||
"#easterhegg-hackertours:example.org\n"
|
"#easterhegg-hackertours:example.org\n"
|
||||||
|
|
@ -52,12 +52,12 @@ class BrandLintTest(unittest.TestCase):
|
||||||
def test_marker_only_ignores_its_own_line(self):
|
def test_marker_only_ignores_its_own_line(self):
|
||||||
result = self.build(
|
result = self.build(
|
||||||
"---\ntitle: Hackertours\n---\n"
|
"---\ntitle: Hackertours\n---\n"
|
||||||
"Hackertours <!-- hackertours-lint-ignore -->\n"
|
"HackerTours <!-- hackertours-lint-ignore -->\n"
|
||||||
"Hackertours\n"
|
"HackerTours\n"
|
||||||
)
|
)
|
||||||
self.assertNotEqual(result.returncode, 0)
|
self.assertNotEqual(result.returncode, 0)
|
||||||
self.assertIn(':5: "Hackertours" should be "Hackertours"', result.stderr)
|
self.assertIn(':5: "HackerTours" should be "Hackertours"', result.stderr)
|
||||||
self.assertNotIn(':4: "Hackertours" should be "Hackertours"', result.stderr)
|
self.assertNotIn(':4: "HackerTours" should be "Hackertours"', result.stderr)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue