Skip to content

Commit 36da399

Browse files
Additional integrity check for example files in test_geophires_examples
1 parent 4604d75 commit 36da399

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

tests/base_test_case.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,7 @@ def assertFileContentsEqual(self, expected, actual):
105105
# noinspection PyPep8Naming,PyMethodMayBeStatic
106106
def assertHasLogRecordWithMessage(self, logs_, message):
107107
assert message in [record.message for record in logs_.records]
108+
109+
# noinspection PyMethodMayBeStatic
110+
def _is_github_actions(self):
111+
return 'CI' in os.environ or 'TOXPYTHON' in os.environ

tests/test_geophires_x.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,13 @@ def get_output_file_for_example(example_file: str):
198198
example_files.remove(ef)
199199
example_files.append(ef)
200200

201-
assert len(example_files) > 0 # test integrity check - no files means something is misconfigured
201+
# Test integrity check - no files means something is misconfigured
202+
assert len(example_files) > 0, 'Test integrity check failed: example files is misconfigured.'
203+
if self._is_github_actions():
204+
# Additional integrity check to catch when temporary local overrides to example file list are accidentally
205+
# checked in.
206+
assert len(example_files) > 10, 'Test integrity check failed: list of example files is too small.'
207+
202208
regenerate_cmds = []
203209
for example_file_path in example_files:
204210
with self.subTest(msg=example_file_path):

0 commit comments

Comments
 (0)