Skip to content

Commit

Permalink
Fix dispatching static_route=None on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl authored and kennethreitz committed Oct 26, 2024
1 parent 4ff73e9 commit 7fba0f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion responder/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __init__(

if static_dir is not None:
if static_route is None:
static_route = static_dir
static_route = ""
static_dir = Path(os.path.abspath(static_dir))

self.static_dir = static_dir
Expand Down
7 changes: 2 additions & 5 deletions tests/test_responder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import random
import string
import sys
from pathlib import Path

import pytest
Expand Down Expand Up @@ -815,9 +814,9 @@ def get(req, resp):

def create_asset(static_dir: Path, name=None, parent_dir: str = None) -> Path:
if name is None:
name = random.choices(string.ascii_letters, k=6) # noqa: S311
name = "".join(random.choices(string.ascii_letters, k=6)) # noqa: S311
# :3
ext = random.choices(string.ascii_letters, k=2) # noqa: S311
ext = "".join(random.choices(string.ascii_letters, k=2)) # noqa: S311
name = f"{name}.{ext}"

if parent_dir is None:
Expand All @@ -833,8 +832,6 @@ def create_asset(static_dir: Path, name=None, parent_dir: str = None) -> Path:

@pytest.mark.parametrize("static_route", [None, "/static", "/custom/static/route"])
def test_staticfiles(tmp_path, static_route):
if sys.platform == "win32" and static_route is None:
raise pytest.skip("Route 'None' currently does not work on Windows")
static_dir = tmp_path / "static"
static_dir.mkdir()

Expand Down

0 comments on commit 7fba0f6

Please sign in to comment.