-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
See hgrecco/flexcache#6. This occurs after the cache_folder argument here was added in #48:
Lines 20 to 21 in d4f0ffd
| # Use a registry cache | |
| registry = pint.UnitRegistry(cache_folder=":auto:") |
Code that uses iam-units and pytest-xdist together is affected. The error occurs sporadically/non-deterministically, depending on which xdist worker(s) are trying to write/read the cache file.
One way to resolve would be:
- Use an optional environment variable for the cache_folder, e.g.:
registry = pint.UnitRegistry(cache_folder=os.environ.get("IAM_UNITS_CACHE", ":auto:"))
- In multiprocessing situations (such as with
pytest-xdist), set a distinct value for this environment variable in each process.
Metadata
Metadata
Assignees
Labels
No labels