Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import gc
import sys
import pytest


@pytest.fixture(autouse=True)
def gc_after_test():
"""Run Python's garbage collection after each test on Windows.

The test suite currently opens many file handles that are not closed until garbage collection
runs. This results in flaky test failures on Windows which has a limit of 512 open file handles
per process. It could be possible to remove this in the future if the problem is solved upstream
(most likely in MIKE IO). See issue below for details:

https://github.com/DHI/mikecore-python/issues/41
"""
if sys.platform.startswith("win"):
yield
gc.collect()
else:
yield