Skip to content

Commit

Permalink
BUG: Fix regression with relative dir paths in 6604a51
Browse files Browse the repository at this point in the history
Fixes #157
  • Loading branch information
kernc committed Feb 5, 2020
1 parent 96e6934 commit 1709915
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pdoc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ def import_module(module, *, reload: bool = False) -> ModuleType:
"""
@contextmanager
def _module_path(module):
from os.path import abspath, basename, dirname, isfile, isdir
from os.path import abspath, dirname, isfile, isdir, split
path = '_pdoc_dummy_nonexistent'
module_name = inspect.getmodulename(module)
if isdir(module):
path, module = dirname(abspath(module)), basename(module)
path, module = split(abspath(module))
elif isfile(module) and module_name:
path, module = dirname(abspath(module)), module_name
try:
Expand Down
5 changes: 5 additions & 0 deletions pdoc/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,11 @@ def test_google_analytics(self):
with run_html(EXAMPLE_MODULE, config='google_analytics="UA-xxxxxx-y"'):
self._check_files(expected)

def test_relative_dir_path(self):
with chdir(os.path.join(TESTS_BASEDIR, EXAMPLE_MODULE)):
with run_html('.'):
self._check_files(())


class ApiTest(unittest.TestCase):
"""
Expand Down

0 comments on commit 1709915

Please sign in to comment.