Skip to content

Commit 22faa35

Browse files
Update usage to reflect the recent addition of the pytest plugin
1 parent b6a9819 commit 22faa35

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

docs/usage.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,17 @@ To manually add `debug` to `__builtins__`, add the following to `sitecustomize.p
113113
which is always imported.
114114

115115
```py
116-
# add devtools `debug` function to builtins
117-
import builtins
118-
try:
119-
from devtools import debug
120-
except ImportError:
121-
pass
122-
else:
123-
setattr(builtins, 'debug', debug)
116+
import sys
117+
# we don't install here for pytest as it breaks pytest, it is
118+
# installed later by a pytest fixture
119+
if not sys.argv[0].endswith('pytest'):
120+
import builtins
121+
try:
122+
from devtools import debug
123+
except ImportError:
124+
pass
125+
else:
126+
setattr(builtins, 'debug', debug)
124127
```
125128

126129
The `ImportError` exception is important since you'll want python to run fine even if *devtools* isn't installed.

0 commit comments

Comments
 (0)