Skip to content

Commit

Permalink
Merge pull request #478 from phst-randomizer/fix-test-video-recordings
Browse files Browse the repository at this point in the history
Don't crash if failing to delete test recording
  • Loading branch information
mike8699 authored Dec 30, 2024
2 parents 80adb03 + fa9ec2d commit 3204150
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/desmume/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections.abc import Generator
from enum import Enum
import logging
import os
from pathlib import Path
import shutil
Expand All @@ -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')
Expand All @@ -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():
Expand Down

0 comments on commit 3204150

Please sign in to comment.