From b470ab66e2db18bbad4c9190635a2d8e0ae8eb81 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sat, 8 Oct 2022 20:43:01 +0300 Subject: [PATCH] Now tests that loser repo is clean and survex runs on 1623.svx and 1626.svx --- core/TESTS/test_imports.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/core/TESTS/test_imports.py b/core/TESTS/test_imports.py index 48e324e..b4838f6 100644 --- a/core/TESTS/test_imports.py +++ b/core/TESTS/test_imports.py @@ -172,4 +172,32 @@ class SubprocessTest(TestCase): msg = f'{cwd} - Failed to find expected git output: "{ph1}" or "{ph2}"' self.assertIsNotNone(phmatch, msg) + def test_loser_survex_status(self): + ''' Expects no failures of survex files + ''' + from pathlib import Path + import troggle.settings as settings + cwd = settings.SURVEX_DATA + for survey in ["1623.svx", "1626.svx"]: + sp = subprocess.run([settings.CAVERN, survey], cwd=cwd, capture_output=True, text=True) + print(f'survex output: {cwd}:\n # {sp.stderr=}\n # {sp.stdout=} \n # return code: {str(sp.returncode)}') + if sp.returncode != 0: + print(f'survex output: {cwd}:\n # {sp.stderr=}\n # {sp.stdout=} \n # return code: {str(sp.returncode)}') + + self.assertTrue( sp.returncode == 0, f'{cwd} - survex is unhappy') + content = sp.stdout + ph = r'Total length of survey legs' + phmatch = re.search(ph, content) + msg = f'{cwd} - Failed to find expected survex output: "{ph}"' + self.assertIsNotNone(phmatch, msg) + + ph1 = r'Time used' + phmatch1 = re.search(ph1, content) + ph2 = r'vertical length of survey le' + phmatch2 = re.search(ph2, content) + + phmatch = phmatch1 or phmatch2 + msg = f'{cwd} - Failed to find expected survex output: "{ph1}" or "{ph2}"' + self.assertIsNotNone(phmatch, msg) +