Skip to content

Commit

Permalink
add fixture to reset threadpool after experimental/api tests
Browse files Browse the repository at this point in the history
any import from experimental will reset the threadpool to 0
in order to have all other tests run normally, we reset it after
each test module for the experimental tests
further reference:
see ilastik#2517
  • Loading branch information
k-dominik committed Aug 25, 2022
1 parent 09f0a4c commit 6589fb6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
10 changes: 9 additions & 1 deletion pytest.ini
@@ -1,6 +1,14 @@
[pytest]
qt_api=pyqt5
python_files = test*.py
testpaths = tests
testpaths = tests lazyflow
markers =
guitest: mark a test as a gui test

addopts =
--doctest-modules
--doctest-ignore-import-errors
--doctest-continue-on-failure
--ignore=tests/test_ilastik/data
--ignore=tests/test_ilastik/helpers
--ignore=lazyflow/cancel_token.py
9 changes: 0 additions & 9 deletions setup.cfg
Expand Up @@ -9,12 +9,3 @@ include_package_data = True

[options.packages.find] #optional
include=ilastik*, lazyflow*

[tool:pytest]
python_files = test*.py
testpaths = tests lazyflow
addopts =
-p no:pytest-qt
--doctest-modules
--doctest-ignore-import-errors
--doctest-continue-on-failure
13 changes: 13 additions & 0 deletions tests/test_ilastik/test_experimental/conftest.py
Expand Up @@ -40,3 +40,16 @@ def test_data_lookup(data_path, tmpdir_factory) -> types.ApiTestDataLookup:
pytest.fail(fail_msg)

return types.ApiTestDataLookup(path_by_name)


@pytest.fixture(scope="module", autouse=True)
def restore_lazyflow_thread_pool():
# any import from experimental will reset the threadpool to 0
# in order to have all other tests run normally, we reset it after
# each test module for the experimental tests
# further reference:
# see https://github.com/ilastik/ilastik/issues/2517
yield
import lazyflow

lazyflow.request.Request.reset_thread_pool()

0 comments on commit 6589fb6

Please sign in to comment.