P28-01-RESTART: 現HEADの性能基準:途中保存・別PID再開の再現
This commit is contained in:
+22
-4
@@ -191,6 +191,24 @@ def synthetic_receipt(out):
|
|||||||
|
|
||||||
|
|
||||||
class RestartTests(unittest.TestCase):
|
class RestartTests(unittest.TestCase):
|
||||||
|
@staticmethod
|
||||||
|
def here_inventory():
|
||||||
|
return {str(path.relative_to(check.HERE)): hashlib.sha256(path.read_bytes()).hexdigest()
|
||||||
|
for path in check.HERE.rglob("*") if path.is_file()}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
cls.inventory_before = cls.here_inventory()
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
# Check after every test, including failures, independently of test order.
|
||||||
|
self.addCleanup(lambda: self.assertEqual(self.here_inventory(), self.inventory_before))
|
||||||
|
|
||||||
|
def test_zz_here_inventory_unchanged(self):
|
||||||
|
# unittest's default ordering places this after all twelve existing tests.
|
||||||
|
self.assertIn("test_restart.py", self.inventory_before)
|
||||||
|
self.assertEqual(self.here_inventory(), self.inventory_before)
|
||||||
|
|
||||||
def rejects(self, original, mutations, validator):
|
def rejects(self, original, mutations, validator):
|
||||||
for name, mutation in mutations.items():
|
for name, mutation in mutations.items():
|
||||||
with self.subTest(rejection=name):
|
with self.subTest(rejection=name):
|
||||||
@@ -328,7 +346,7 @@ class RestartTests(unittest.TestCase):
|
|||||||
next(iterator)
|
next(iterator)
|
||||||
|
|
||||||
def test_d3_transfer_and_fresh_profiles(self):
|
def test_d3_transfer_and_fresh_profiles(self):
|
||||||
with tempfile.TemporaryDirectory(dir=check.HERE) as temporary:
|
with tempfile.TemporaryDirectory(dir=os.environ.get("BUILD_OUTPUT_DIR") or None) as temporary:
|
||||||
base = Path(temporary)
|
base = Path(temporary)
|
||||||
source = base / "source"
|
source = base / "source"
|
||||||
source.mkdir()
|
source.mkdir()
|
||||||
@@ -366,7 +384,7 @@ class RestartTests(unittest.TestCase):
|
|||||||
check.check_probe(text.replace("GameClock.advance_minutes(1)", replacement))
|
check.check_probe(text.replace("GameClock.advance_minutes(1)", replacement))
|
||||||
|
|
||||||
def test_rs7_rs8_full_receipt_rejections(self):
|
def test_rs7_rs8_full_receipt_rejections(self):
|
||||||
with tempfile.TemporaryDirectory(dir=check.HERE) as temporary:
|
with tempfile.TemporaryDirectory(dir=os.environ.get("BUILD_OUTPUT_DIR") or None) as temporary:
|
||||||
out = Path(temporary)
|
out = Path(temporary)
|
||||||
receipt = synthetic_receipt(out)
|
receipt = synthetic_receipt(out)
|
||||||
check.check_receipt(receipt, out)
|
check.check_receipt(receipt, out)
|
||||||
@@ -391,7 +409,7 @@ class RestartTests(unittest.TestCase):
|
|||||||
check.check_receipt(receipt, out)
|
check.check_receipt(receipt, out)
|
||||||
|
|
||||||
def test_d6_raw_report_and_audio(self):
|
def test_d6_raw_report_and_audio(self):
|
||||||
with tempfile.TemporaryDirectory(dir=check.HERE) as temporary:
|
with tempfile.TemporaryDirectory(dir=os.environ.get("BUILD_OUTPUT_DIR") or None) as temporary:
|
||||||
out = Path(temporary)
|
out = Path(temporary)
|
||||||
receipt = synthetic_receipt(out)
|
receipt = synthetic_receipt(out)
|
||||||
row = receipt["phases"][3]
|
row = receipt["phases"][3]
|
||||||
@@ -418,7 +436,7 @@ class RestartTests(unittest.TestCase):
|
|||||||
"time.sleep(0.15)\n"
|
"time.sleep(0.15)\n"
|
||||||
"if mode=='timeout': time.sleep(5)\n"
|
"if mode=='timeout': time.sleep(5)\n"
|
||||||
"sys.exit(3 if mode=='exit' else 0)\n")
|
"sys.exit(3 if mode=='exit' else 0)\n")
|
||||||
with tempfile.TemporaryDirectory(dir=check.HERE) as temporary:
|
with tempfile.TemporaryDirectory(dir=os.environ.get("BUILD_OUTPUT_DIR") or None) as temporary:
|
||||||
base = Path(temporary)
|
base = Path(temporary)
|
||||||
script = base / "fake-child"
|
script = base / "fake-child"
|
||||||
script.write_text(child)
|
script.write_text(child)
|
||||||
|
|||||||
Reference in New Issue
Block a user