Skip to content

Commit 7fba0f6

Browse files
amotlkennethreitz
authored andcommitted
Fix dispatching static_route=None on Windows
1 parent 4ff73e9 commit 7fba0f6

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

responder/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def __init__(
6565

6666
if static_dir is not None:
6767
if static_route is None:
68-
static_route = static_dir
68+
static_route = ""
6969
static_dir = Path(os.path.abspath(static_dir))
7070

7171
self.static_dir = static_dir

tests/test_responder.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import random
22
import string
3-
import sys
43
from pathlib import Path
54

65
import pytest
@@ -815,9 +814,9 @@ def get(req, resp):
815814

816815
def create_asset(static_dir: Path, name=None, parent_dir: str = None) -> Path:
817816
if name is None:
818-
name = random.choices(string.ascii_letters, k=6) # noqa: S311
817+
name = "".join(random.choices(string.ascii_letters, k=6)) # noqa: S311
819818
# :3
820-
ext = random.choices(string.ascii_letters, k=2) # noqa: S311
819+
ext = "".join(random.choices(string.ascii_letters, k=2)) # noqa: S311
821820
name = f"{name}.{ext}"
822821

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

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

0 commit comments

Comments
 (0)