We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 12cf19e commit 5b4dd8fCopy full SHA for 5b4dd8f
message_ix/testing/__init__.py
@@ -25,6 +25,16 @@
25
# Pytest hooks
26
27
28
+def pytest_configure(config: pytest.Config) -> None:
29
+ """Force iam-units to use a distinct cache for each worker.
30
+
31
+ Work around for https://github.com/hgrecco/flexcache/issues/6 /
32
+ https://github.com/IAMconsortium/units/issues/54.
33
+ """
34
+ name = f"iam-units-{os.environ.get('PYTEST_XDIST_WORKER', '')}".rstrip("-")
35
+ os.environ["IAM_UNITS_CACHE"] = str(config.cache.mkdir(name))
36
37
38
def pytest_report_header(config: pytest.Config, start_path: Path) -> str:
39
"""Add the message_ix import path to the pytest report header."""
40
import message_ix
0 commit comments