Skip to content

Commit

Permalink
fix tests on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladyslav49 committed Mar 10, 2024
1 parent a625cab commit 08aa880
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion tests/test_response.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import itertools
import re
from contextlib import AbstractContextManager, nullcontext
from datetime import datetime, timedelta, UTC
from email.utils import format_datetime
Expand Down Expand Up @@ -142,7 +143,7 @@ def test_invalid_file_path(tmp_path: Path) -> None:
directory.mkdir()

with pytest.raises(
ValueError, match=f"'{directory}' is not a valid file path"
ValueError, match=re.escape(f"'{directory}' is not a valid file path")
):
FileResponse(directory)

Expand Down
9 changes: 7 additions & 2 deletions tests/test_staticfiles.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
from pathlib import Path
from unittest.mock import Mock, create_autospec

Expand All @@ -24,7 +25,9 @@ def test_create_staticfiles_with_nonexistent_directory(tmp_path: Path) -> None:

with pytest.raises(
NotADirectoryError,
match=f"Directory {str(directory)!r} does not exist or is not a directory",
match=re.escape(
f"Directory {str(directory)!r} does not exist or is not a directory"
),
):
StaticFiles(directory=directory)

Expand All @@ -37,7 +40,9 @@ def test_create_staticfiles_with_file_instead_of_directory(

with pytest.raises(
NotADirectoryError,
match=f"Directory {str(file)!r} does not exist or is not a directory",
match=re.escape(
f"Directory {str(file)!r} does not exist or is not a directory"
),
):
StaticFiles(directory=file)

Expand Down

0 comments on commit 08aa880

Please sign in to comment.