Skip to content

Failing unit tests on Windows

Summary

Many unit tests fail on Windows, often due to permission errors with temporary files:

FAILED unittests/test_cfood_metadata.py::test_warning_if_no_version_specified - Failed: DID NOT WARN. No warnings of type (<class 'UserWarning'>,) were emitted.
FAILED unittests/test_cfood_metadata.py::test_warning_if_version_too_old - Failed: DID NOT WARN. No warnings of type (<class 'UserWarning'>,) were emitted.
FAILED unittests/test_cfood_metadata.py::test_error_if_version_too_new - PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Joscha\\AppData\\Local\\Temp\\tmp9sezi6sb'
FAILED unittests/test_cfood_metadata.py::test_matching_version - PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Joscha\\AppData\\Local\\Temp\\tmp5q1t5c3c'
FAILED unittests/test_crawler.py::test_synchronization_no_commit - sqlite3.OperationalError: unable to open database file
FAILED unittests/test_crawler.py::test_security_mode - sqlite3.OperationalError: unable to open database file
FAILED unittests/test_crawler.py::test_split_restricted_path - AssertionError: assert ['el'] == ['/el']
FAILED unittests/test_macros.py::test_load_definition - FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Joscha\\AppData\\Local\\Temp\\tmp0x2s91_5'
FAILED unittests/test_macros.py::test_macros_in_macros - FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Joscha\\AppData\\Local\\Temp\\tmp70dxzc7x'
FAILED unittests/test_macros.py::test_circular_macro_definition - FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Joscha\\AppData\\Local\\Temp\\tmpc8k60we9'
FAILED unittests/test_macros.py::test_use_macro_twice - FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Joscha\\AppData\\Local\\Temp\\tmpmmmrqfbu'
FAILED unittests/test_macros.py::test_documentation_example_2 - FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Joscha\\AppData\\Local\\Temp\\tmpp7kt8204'
FAILED unittests/test_macros.py::test_documentation_example_1 - FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Joscha\\AppData\\Local\\Temp\\tmp1foe_g1_'
FAILED unittests/test_rocrate_converter.py::test_load_pasta - ValueError: no @id in {'value': 'Test if everything is working as intended.', 'propertyID': '.objective', 'name': ' → Objective', '@type': 'PropertyValue', 'description': 'What is the objective?'}
FAILED unittests/test_rocrate_converter.py::test_load_kadi4mat - ValueError: no @id in {'@type': 'PropertyValue', 'additionalType': 'str', 'propertyID': 'type', 'value': 'Measurement'}
FAILED unittests/test_rocrate_converter.py::test_scanner - ValueError: no @id in {'value': 'Test if everything is working as intended.', 'propertyID': '.objective', 'name': ' → Objective', '@type': 'PropertyValue', 'description': 'What is the objective?'}
FAILED unittests/test_scanner.py::test_record_structure_generation - AssertionError: assert 'examples_art...\DataAnalysis' == 'examples_art.../DataAnalysis'
FAILED unittests/test_scripts.py::test_script_loading - subprocess.CalledProcessError: Command '['spss_to_datamodel', '-h']' returned non-zero exit status 1.
FAILED unittests/test_spss_converter.py::test_spss_converter - RuntimeError: This class (SPSSConverter) cannot be used, because some libraries are missing.
FAILED unittests/test_utilities.py::test_split_restricted_path - AssertionError: assert ['/'] == []
ERROR unittests/test_rocrate_converter.py::test_match_rocrate_entities - ValueError: no @id in {'@type': 'PropertyValue', 'additionalType': 'str', 'propertyID': 'type', 'value': 'Measurement'}
ERROR unittests/test_rocrate_converter.py::test_file - ValueError: no @id in {'@type': 'PropertyValue', 'additionalType': 'str', 'propertyID': 'type', 'value': 'Measurement'}
ERROR unittests/test_rocrate_converter.py::test_has_part - ValueError: no @id in {'@type': 'PropertyValue', 'additionalType': 'str', 'propertyID': 'type', 'value': 'Measurement'}
==================================================================================================================================================================================== 20 failed, 106 passed, 5 xfailed, 30 warnings, 3 errors in 4.33s ============================================================================================================================

Expected Behavior

Unit tests should not fail on Windows

Actual Behavior

Steps to Reproduce the Problem

Please describe, step by step, how others can reproduce the problem. Please try these steps for yourself on a clean system.

  1. Setup repo on Windows
  2. Run pytest

Specifications

  • Version: 0.11-dev
  • Platform: Windows 11, Python 3.12.3

Possible fixes