willkg / markus

Markus is a Python library for generating metrics
Mozilla Public License 2.0
70 stars 8 forks source link

pytest import in `__init__.py` makes it difficult to determine when pytest is running #95

Closed jwhitlock closed 2 years ago

jwhitlock commented 2 years ago

For https://github.com/mozilla/fx-private-relay/pull/1809, I wanted to enable code only if we're not running pytest. There's one way to do it, and a quick way (if "pytest" in sys.modules). Because markus imports pytest early (added for https://github.com/willkg/markus/issues/73), the quick method doesn't work.

I think I can make this work by adding a pytest plugin.

willkg commented 2 years ago

Fixed by #96.