35 lines
1.3 KiB
Diff
35 lines
1.3 KiB
Diff
|
---
|
|||
|
tests/test_serving.py | 12 ++++++++----
|
|||
|
1 file changed, 8 insertions(+), 4 deletions(-)
|
|||
|
|
|||
|
--- a/tests/test_serving.py
|
|||
|
+++ b/tests/test_serving.py
|
|||
|
@@ -10,6 +10,7 @@ from pathlib import Path
|
|||
|
|
|||
|
import pytest
|
|||
|
|
|||
|
+import werkzeug
|
|||
|
from werkzeug import run_simple
|
|||
|
from werkzeug._reloader import _find_stat_paths
|
|||
|
from werkzeug._reloader import _find_watchdog_paths
|
|||
|
@@ -127,12 +128,15 @@ def test_windows_get_args_for_reloading(
|
|||
|
|
|||
|
@pytest.mark.parametrize("find", [_find_stat_paths, _find_watchdog_paths])
|
|||
|
def test_exclude_patterns(find):
|
|||
|
- # Imported paths under sys.prefix will be included by default.
|
|||
|
+ # Don’t use sys.prefix, we may have redefined PYTHONPATH and
|
|||
|
+ # libraries elsewhere.
|
|||
|
+ cur_prefix = str(Path(werkzeug.__file__).parents[1])
|
|||
|
+ # Imported paths under cur_prefix will be included by default.
|
|||
|
paths = find(set(), set())
|
|||
|
- assert any(p.startswith(sys.prefix) for p in paths)
|
|||
|
+ assert any(p.startswith(cur_prefix) for p in paths)
|
|||
|
# Those paths should be excluded due to the pattern.
|
|||
|
- paths = find(set(), {f"{sys.prefix}*"})
|
|||
|
- assert not any(p.startswith(sys.prefix) for p in paths)
|
|||
|
+ paths = find(set(), {f"{str(cur_prefix)}*"})
|
|||
|
+ assert not any(p.startswith(cur_prefix) for p in paths)
|
|||
|
|
|||
|
|
|||
|
@pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning")
|