Skip to content

Commit a959dd6

Browse files
committed
Skip MultiDict.from_fieldstorage tests on 3.13+
1 parent 24715c3 commit a959dd6

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/webob/multidict.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def view_list(cls, lst):
5656
return obj
5757

5858
@classmethod
59-
def from_fieldstorage(cls, fs):
59+
def from_fieldstorage(cls, fs): # pragma: no cover
6060
"""
6161
Create a multidict from a cgi.FieldStorage instance
6262

tests/test_multidict.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
import sys
2+
13
import pytest
24

35
from webob import multidict
46
from webob.util import text_
57

8+
requires_cgi = pytest.mark.skipif(
9+
sys.version_info >= (3, 13), reason="requires `cgi` module"
10+
)
11+
612

713
class BaseDictTests:
814
def setup_method(self, method):
@@ -139,20 +145,23 @@ def test_view_list(self):
139145
d = MultiDict()
140146
assert d.view_list([1, 2])._items == [1, 2]
141147

148+
@requires_cgi
142149
def test_from_fieldstorage_with_filename(self):
143150
from webob.multidict import MultiDict
144151

145152
d = MultiDict()
146153
fs = DummyFieldStorage("a", "1", "file")
147154
assert d.from_fieldstorage(fs) == MultiDict({"a": fs.list[0]})
148155

156+
@requires_cgi
149157
def test_from_fieldstorage_without_filename(self):
150158
from webob.multidict import MultiDict
151159

152160
d = MultiDict()
153161
fs = DummyFieldStorage("a", "1")
154162
assert d.from_fieldstorage(fs) == MultiDict({"a": "1"})
155163

164+
@requires_cgi
156165
def test_from_fieldstorage_with_charset(self):
157166
from cgi import FieldStorage
158167

@@ -182,6 +191,7 @@ def test_from_fieldstorage_with_charset(self):
182191
"utf8"
183192
)
184193

194+
@requires_cgi
185195
def test_from_fieldstorage_with_base64_encoding(self):
186196
from cgi import FieldStorage
187197

@@ -212,6 +222,7 @@ def test_from_fieldstorage_with_base64_encoding(self):
212222
"utf8"
213223
)
214224

225+
@requires_cgi
215226
def test_from_fieldstorage_with_quoted_printable_encoding(self):
216227
from cgi import FieldStorage
217228

0 commit comments

Comments
 (0)