python-Werkzeug/moved_root.patch

37 lines
1.5 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
tests/test_serving.py | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
Index: Werkzeug-2.2.3/tests/test_serving.py
===================================================================
--- Werkzeug-2.2.3.orig/tests/test_serving.py
+++ Werkzeug-2.2.3/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
@@ -128,12 +129,15 @@ def test_windows_get_args_for_reloading(
@pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning")
@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.
+ # Dont 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")