Skip to content

Commit 94e7899

Browse files
authored
Merge pull request #147 from kayjan/fix-doctest-setup
Fixed: conf.py reusable os codes
2 parents 4ab22b4 + 81b56bc commit 94e7899

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/source/conf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@
3535
myst_enable_extensions = [
3636
"attrs_block",
3737
]
38-
base_dir = "/".join(os.getcwd().split("/")[:-2])
38+
base_dir = os.path.dirname(os.path.dirname(os.getcwd()))
39+
assets_dir = os.path.join(base_dir, "assets", "docstr")
3940
doctest_global_setup = f"""
4041
import os
41-
os.chdir("{base_dir}")
42-
if not os.path.exists("assets/docstr"):
43-
os.mkdir("assets/docstr")
42+
if not os.path.exists(r"{assets_dir}"):
43+
os.mkdir(r"{assets_dir}")
4444
"""
4545

4646
templates_path = ["_templates"]

0 commit comments

Comments
 (0)