Skip to content

Commit 1709915

Browse files
committed
BUG: Fix regression with relative dir paths in 6604a51
Fixes #157
1 parent 96e6934 commit 1709915

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

pdoc/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,11 @@ def import_module(module, *, reload: bool = False) -> ModuleType:
164164
"""
165165
@contextmanager
166166
def _module_path(module):
167-
from os.path import abspath, basename, dirname, isfile, isdir
167+
from os.path import abspath, dirname, isfile, isdir, split
168168
path = '_pdoc_dummy_nonexistent'
169169
module_name = inspect.getmodulename(module)
170170
if isdir(module):
171-
path, module = dirname(abspath(module)), basename(module)
171+
path, module = split(abspath(module))
172172
elif isfile(module) and module_name:
173173
path, module = dirname(abspath(module)), module_name
174174
try:

pdoc/test/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,11 @@ def test_google_analytics(self):
374374
with run_html(EXAMPLE_MODULE, config='google_analytics="UA-xxxxxx-y"'):
375375
self._check_files(expected)
376376

377+
def test_relative_dir_path(self):
378+
with chdir(os.path.join(TESTS_BASEDIR, EXAMPLE_MODULE)):
379+
with run_html('.'):
380+
self._check_files(())
381+
377382

378383
class ApiTest(unittest.TestCase):
379384
"""

0 commit comments

Comments
 (0)