diff --git a/pyproject.toml b/pyproject.toml index 0cf57ab0b..e9087204d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,6 +74,7 @@ dev = [ "pexpect", "pre-commit", "pytest", + "pytest-benchmark", ] full = [ "ipywidgets", diff --git a/test/conftest.py b/test/conftest.py new file mode 100644 index 000000000..4c57d3368 --- /dev/null +++ b/test/conftest.py @@ -0,0 +1,11 @@ +# Code that gets run before pytest runs.. +import gc + + +def pytest_sessionfinish(session, exitstatus): + """Executes after all tests have completed. + + Freeze objects right before pytest exits. This prevents PyGC_Collect from + walking Generation 2 objects during _Py_Finalize. + """ + gc.freeze()