diff --git a/tests/definitions_test.py b/tests/definitions_test.py index dce19f84a..c8430123b 100644 --- a/tests/definitions_test.py +++ b/tests/definitions_test.py @@ -63,6 +63,10 @@ def _get_diff_from_upstream(): for file in changes: # Ensure the files are modified or added, this will disclude deleted files if file.change_type in CHANGE_TYPE_LIST: + # Check if the file is a .pickle file + if 'known-slugs.pickle' in file.__str__(): + file_list.append(('tests/known-slugs.pickle', 'pickle')) + # If the file is renamed, ensure we are picking the right schema if 'R' in file.change_type and path in file.rename_to: file_list.append((file.rename_to, schema)) @@ -120,6 +124,9 @@ def test_definitions(file_path, schema): """ Validate each definition file using the provided JSON schema and check for duplicate entries. """ + if schema == 'pickle': + pytest.fail(f'Pickle file modification detected: {file_path}\nPlease revert and remove the pickle file from your commit.', False) + # Check file extension. Only .yml or .yaml files are supported. assert file_path.split('.')[-1] in ('yaml', 'yml'), f"Invalid file extension: {file_path}"