• R/O
  • SSH

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Castle: The best Real-Time/Embedded/HighTech language EVER. Attempt 2


Commit MetaInfo

Révisionc63a41dd6ef42c834212b43e3f3bb1d0edfac6d3 (tree)
l'heure2023-10-03 05:31:51
AuteurAlbert Mietus < albert AT mietus DOT nl >
CommiterAlbert Mietus < albert AT mietus DOT nl >

Message de Log

Refactored TstDoubles (test setup)

Change Summary

Modification

diff -r 655b2a8b6a00 -r c63a41dd6ef4 pytst/writers/RPy/__init__.py
--- a/pytst/writers/RPy/__init__.py Mon Oct 02 20:48:31 2023 +0200
+++ b/pytst/writers/RPy/__init__.py Mon Oct 02 22:31:51 2023 +0200
@@ -43,4 +43,19 @@
4343
4444
4545
46+class TstDoubles():
47+ _top = Path('TestDoubles')
48+ _ref, _gen = Path('reference'), Path('_generated')
4649
50+ def __init__(self, base_name):
51+ self.base_name = Path(base_name)
52+
53+ @property
54+ def ref_file(self, ext='.rpy'):
55+ return self._top / self._ref / self.base_name.with_suffix(ext)
56+
57+ @property
58+ def gen_file(self, ext='.rpy'):
59+ return self._top / self._gen / self.base_name.with_suffix(ext)
60+
61+
diff -r 655b2a8b6a00 -r c63a41dd6ef4 pytst/writers/RPy/test_99_SieveMoats.py
--- a/pytst/writers/RPy/test_99_SieveMoats.py Mon Oct 02 20:48:31 2023 +0200
+++ b/pytst/writers/RPy/test_99_SieveMoats.py Mon Oct 02 22:31:51 2023 +0200
@@ -7,33 +7,23 @@
77
88 from TestDoubles.AIGR.protocols import Sieve
99
10-from . import T_Protocol
11-
12-
13-
10+from . import T_Protocol, TstDoubles
1411
1512
1613 def test_01_StartSieve(T_Protocol):
17- ref_file = 'TestDoubles/reference/protocols/StartSieve.rpy'
18- gen_file = 'Testdoubles/_generated/protocols/StartSieve.rpy'
19-
14+ td = TstDoubles('protocols/StartSieve')
2015 out = T_Protocol.render(protocols=[Sieve.StartSieve,])
21- with open(gen_file, 'w') as f:
16+ with open(td.gen_file, 'w') as f:
2217 f.write(out)
23- logger.debug(f"Comparing the generated file ({gen_file}) and the reference ({ref_file})")
24- assert filecmp.cmp(gen_file, ref_file), f"The generated file ({gen_file}) and the reference ({ref_file}) are not the same"
18+ assert filecmp.cmp(td.gen_file, td.ref_file), f"The generated file ({td.gen_file}) and the reference ({td.ref_file}) are not the same"
2519
2620
27-#@pytest.mark.skip("Need to test AIGR.protocols:: parameters first (and writer for it to)")
2821 def test_03_SlowStart(T_Protocol):
29- ref_file = 'TestDoubles/reference/protocols/SlowStart.rpy'
30- gen_file = 'Testdoubles/_generated/protocols/SlowStart.rpy'
31-
22+ td = TstDoubles('protocols/SlowStart')
3223 out = T_Protocol.render(protocols=[Sieve.SlowStart,])
33- with open(gen_file, 'w') as f:
24+ with open(td.gen_file, 'w') as f:
3425 f.write(out)
35- logger.debug(f"Comparing the generated file ({gen_file}) and the reference ({ref_file})")
36- assert filecmp.cmp(gen_file, ref_file), f"The generated file ({gen_file}) and the reference ({ref_file}) are not the same"
26+ assert filecmp.cmp(td.gen_file, td.ref_file), f"The generated file ({td.gen_file}) and the reference ({td.ref_file}) are not the same"
3727
3828
3929