v29.4-roots.4 · Commit 8: [PATCH 08/37] ci: restore assurance and isolate Core fixtures
ci/test/test_nightly_change_gate.py
Before: /dev/null · After: ci/test/test_nightly_change_gate.py
File metadata
new file mode 100755 index 0000000000000000000000000000000000000000..d44fdee167184a9eda4404c52762ced3575f92cc
Download original patch · Release notes
Diff rows 1–29 of 29. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.
ci/test/test_nightly_change_gate.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Regression fixtures for ci/nightly-change-gate.py."""
|
|
3
|
+
|
|
4
|
+
import importlib.util
|
|
5
|
+
import json
|
|
6
|
+
import pathlib
|
|
7
|
+
import unittest
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
CI_ROOT = pathlib.Path(__file__).resolve().parents[1]
|
|
11
|
+
SCRIPT = CI_ROOT / "nightly-change-gate.py"
|
|
12
|
+
FIXTURES = pathlib.Path(__file__).with_name("fixtures") / "nightly-change-gate.json"
|
|
13
|
+
SPEC = importlib.util.spec_from_file_location("nightly_change_gate", SCRIPT)
|
|
14
|
+
MODULE = importlib.util.module_from_spec(SPEC)
|
|
15
|
+
SPEC.loader.exec_module(MODULE)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class NightlyChangeGateTest(unittest.TestCase):
|
|
19
|
+
def test_fixtures(self):
|
|
20
|
+
for fixture in json.loads(FIXTURES.read_text(encoding="utf-8")):
|
|
21
|
+
with self.subTest(fixture=fixture["name"]):
|
|
22
|
+
self.assertEqual(
|
|
23
|
+
MODULE.should_run(
|
|
24
|
+
fixture["event"], fixture["current_run_id"], fixture["current_sha"], fixture["history"]),
|
|
25
|
+
fixture["expected"])
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
if __name__ == "__main__":
|
|
29
|
+
unittest.main()
|