unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob 4eca53f30c77bcbe8c99ac0511046a68376cb161 2163 bytes (raw)
name: packages/patches/python-werkzeug-tests.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
 
Do not leave open files behind as this triggers 'ResourceWarning' and leads
these tests to fail.

--- Werkzeug-1.0.1/tests/test_datastructures.py	2020-03-31 19:48:06.000000000 +0200
+++ Werkzeug-1.0.1/tests/test_datastructures.py	2021-11-21 18:19:11.304369878 +0100
@@ -1238,9 +1238,10 @@
     def test_save_to_pathlib_dst(self, tmp_path):
         src = tmp_path / "src.txt"
         src.write_text(u"test")
-        storage = self.storage_class(src.open("rb"))
-        dst = tmp_path / "dst.txt"
-        storage.save(dst)
+        with src.open("rb") as input:
+            storage = self.storage_class(input)
+            dst = tmp_path / "dst.txt"
+            storage.save(dst)
         assert dst.read_text() == "test"
 
     def test_save_to_bytes_io(self):
@@ -1251,11 +1252,12 @@
 
     def test_save_to_file(self, tmp_path):
         path = tmp_path / "file.data"
-        storage = self.storage_class(io.BytesIO(b"one\ntwo"))
-        with path.open("wb") as dst:
-            storage.save(dst)
-        with path.open("rb") as src:
-            assert src.read() == b"one\ntwo"
+        with io.BytesIO(b"one\ntwo") as input:
+            storage = self.storage_class(input)
+            with path.open("wb") as dst:
+                storage.save(dst)
+            with path.open("rb") as src:
+                assert src.read() == b"one\ntwo"
 
 
 @pytest.mark.parametrize("ranges", ([(0, 1), (-5, None)], [(5, None)]))
--- Werkzeug-1.0.1/tests/test_formparser.py	2020-03-31 19:48:06.000000000 +0200
+++ Werkzeug-1.0.1/tests/test_formparser.py	2021-11-21 22:11:43.654622751 +0100
@@ -27,7 +27,7 @@
 from werkzeug.test import create_environ
 from werkzeug.wrappers import Request
 from werkzeug.wrappers import Response
-
+import warnings
 
 @Request.application
 def form_data_consumer(request):
@@ -242,6 +244,9 @@
 
 class TestMultiPart(object):
     def test_basic(self):
+        # Ignore leaked file descriptor of unknown origin.
+        warnings.filterwarnings(action="ignore", message="unclosed", category=ResourceWarning)
+
         resources = join(dirname(__file__), "multipart")
         client = Client(form_data_consumer, Response)
 

debug log:

solving 4eca53f30c77bcbe8c99ac0511046a68376cb161 ...
found 4eca53f30c77bcbe8c99ac0511046a68376cb161 in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).