Skip to content

Commit

Permalink
chore: more debuggin'
Browse files Browse the repository at this point in the history
  • Loading branch information
vytas7 committed Aug 15, 2024
1 parent 6eb97f6 commit 1040983
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/test_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ def normalize_path(path):
# Unix-like absolute paths that start with a single \.
# We work around this in tests by prepending a fake drive D:\ on Windows.
# See also: https://github.com/python/cpython/issues/117352
if not posixpath.isabs(path):
is_pathlib_path = isinstance(path, pathlib.Path)
if not is_pathlib_path and not posixpath.isabs(path):
return path

path = os.path.normpath(path)
if os.path.normpath(path).startswith('\\'):
if path.startswith('\\'):
path = 'D:' + path
return path
return pathlib.Path(path) if is_pathlib_path else path


@pytest.fixture()
Expand All @@ -45,6 +47,7 @@ def add_static_route_normalized(obj, prefix, directory, **kwargs):

def create_sr(asgi, prefix, directory, **kwargs):
sr_type = StaticRouteAsync if asgi else StaticRoute
print(f'creating {sr_type.__name__}{(prefix, normalize_path(directory))}')
return sr_type(prefix, normalize_path(directory), **kwargs)


Expand Down

0 comments on commit 1040983

Please sign in to comment.