diff --git a/tests/desmume/conftest.py b/tests/desmume/conftest.py index c87ea283..31ffee6b 100644 --- a/tests/desmume/conftest.py +++ b/tests/desmume/conftest.py @@ -1,5 +1,6 @@ from collections.abc import Generator from enum import Enum +import logging import os from pathlib import Path import shutil @@ -14,6 +15,8 @@ from .emulator_utils import AbstractEmulatorWrapper from .melonds import MelonDSWrapper +logger = logging.getLogger(__name__) + def pytest_addoption(parser): parser.addoption('--desmume', action='store_true', default=False, help='Enable DeSmuME tests') @@ -33,7 +36,10 @@ def test_teardown(rom_path: Path, request): # If the test didn't fail, just delete the recording if tests_failed_before == request.session.testsfailed: - video_path.unlink(missing_ok=True) + try: + video_path.unlink(missing_ok=True) + except PermissionError: + logger.warning(f'Failed to delete video recording {video_path}') return for file in video_path.parent.iterdir():