File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
src/mkdocstrings_handlers/python Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -145,7 +145,8 @@ def __init__(
145145 super ().__init__ (* args , ** kwargs )
146146 self ._config_file_path = config_file_path
147147 paths = paths or []
148- with chdir (os .path .dirname (config_file_path ) if config_file_path else "." ):
148+ glob_base_dir = os .path .dirname (os .path .abspath (config_file_path )) if config_file_path else "."
149+ with chdir (glob_base_dir ):
149150 resolved_globs = [glob .glob (path ) for path in paths ]
150151 paths = [path for glob_list in resolved_globs for path in glob_list ]
151152 if not paths and config_file_path :
Original file line number Diff line number Diff line change 11"""Tests for the `handler` module."""
22
3+ import os
4+ from glob import glob
5+
36import pytest
47from griffe .docstrings .dataclasses import DocstringSectionExamples , DocstringSectionKind
58
@@ -83,3 +86,15 @@ def test_expand_globs(tmp_path):
8386 )
8487 for path in globbed_paths : # noqa: WPS440
8588 assert str (path ) in handler ._paths # noqa: WPS437
89+
90+
91+ def test_expand_globs_without_changing_directory ():
92+ """Assert globs are correctly expanded when we are already in the right directory."""
93+ handler = PythonHandler (
94+ handler = "python" ,
95+ theme = "material" ,
96+ config_file_path = "mkdocs.yml" ,
97+ paths = ["*.md" ],
98+ )
99+ for path in list (glob (os .path .abspath ("." ) + "/*.md" )):
100+ assert path in handler ._paths # noqa: WPS437
You can’t perform that action at this time.
0 commit comments