|
| 1 | +import sys |
| 2 | + |
1 | 3 | import pytest |
2 | 4 |
|
3 | 5 | from webob import multidict |
4 | 6 | from webob.util import text_ |
5 | 7 |
|
| 8 | +requires_cgi = pytest.mark.skipif( |
| 9 | + sys.version_info >= (3, 13), reason="requires `cgi` module" |
| 10 | +) |
| 11 | + |
6 | 12 |
|
7 | 13 | class BaseDictTests: |
8 | 14 | def setup_method(self, method): |
@@ -139,20 +145,23 @@ def test_view_list(self): |
139 | 145 | d = MultiDict() |
140 | 146 | assert d.view_list([1, 2])._items == [1, 2] |
141 | 147 |
|
| 148 | + @requires_cgi |
142 | 149 | def test_from_fieldstorage_with_filename(self): |
143 | 150 | from webob.multidict import MultiDict |
144 | 151 |
|
145 | 152 | d = MultiDict() |
146 | 153 | fs = DummyFieldStorage("a", "1", "file") |
147 | 154 | assert d.from_fieldstorage(fs) == MultiDict({"a": fs.list[0]}) |
148 | 155 |
|
| 156 | + @requires_cgi |
149 | 157 | def test_from_fieldstorage_without_filename(self): |
150 | 158 | from webob.multidict import MultiDict |
151 | 159 |
|
152 | 160 | d = MultiDict() |
153 | 161 | fs = DummyFieldStorage("a", "1") |
154 | 162 | assert d.from_fieldstorage(fs) == MultiDict({"a": "1"}) |
155 | 163 |
|
| 164 | + @requires_cgi |
156 | 165 | def test_from_fieldstorage_with_charset(self): |
157 | 166 | from cgi import FieldStorage |
158 | 167 |
|
@@ -182,6 +191,7 @@ def test_from_fieldstorage_with_charset(self): |
182 | 191 | "utf8" |
183 | 192 | ) |
184 | 193 |
|
| 194 | + @requires_cgi |
185 | 195 | def test_from_fieldstorage_with_base64_encoding(self): |
186 | 196 | from cgi import FieldStorage |
187 | 197 |
|
@@ -212,6 +222,7 @@ def test_from_fieldstorage_with_base64_encoding(self): |
212 | 222 | "utf8" |
213 | 223 | ) |
214 | 224 |
|
| 225 | + @requires_cgi |
215 | 226 | def test_from_fieldstorage_with_quoted_printable_encoding(self): |
216 | 227 | from cgi import FieldStorage |
217 | 228 |
|
|
0 commit comments