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 3546ab7 commit 5437cbaCopy full SHA for 5437cba
docs/conftest.py
@@ -0,0 +1,20 @@
1
+import os
2
+from pathlib import Path
3
+
4
+import pytest
5
6
7
+@pytest.fixture(autouse=True)
8
+def tmp_doctest_path(request, tmp_path):
9
+ """Run doctests in isolated temp dir so outputs do not end up in repo"""
10
+ # Trigger ONLY for doctestplus
11
+ doctest_plugin = request.config.pluginmanager.getplugin("doctestplus")
12
+ if isinstance(request.node.parent, doctest_plugin._doctest_textfile_item_cls):
13
+ start_path = Path.cwd()
14
+ os.chdir(tmp_path)
15
+ try:
16
+ yield tmp_path
17
+ finally:
18
+ os.chdir(start_path)
19
+ else:
20
+ yield
0 commit comments