Modify ↓
Opened 13 months ago
Closed 13 months ago
#13788 closed defect (fixed)
Unit tests failing with multipart 1.0.0
| Reported by: | Jun Omae | Owned by: | Jun Omae |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.6.1 |
| Component: | general | Version: | 1.6 |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: |
Adapted unit tests to multipart 1.0.0+. |
||
| API Changes: | |||
| Internal Changes: | |||
Description
After multipart 1.0.0 is released on Sep 21, 2024, unit tests failed.
======================================================================
ERROR: test_getfile (trac.web.tests.api.RequestTestCase.test_getfile)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jun66j5/src/tracdev/git/trac/web/tests/api.py", line 287, in test_getfile
self.assertEqual(file_content, file_[1].getvalue())
^^^^^^^^^^^^^^^^^
AttributeError: 'SpooledTemporaryFile' object has no attribute 'getvalue'
======================================================================
ERROR: test_getfilelist (trac.web.tests.api.RequestTestCase.test_getfilelist)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jun66j5/src/tracdev/git/trac/web/tests/api.py", line 330, in test_getfilelist
self.assertEqual(file_content[0], file_[0][1].getvalue())
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'SpooledTemporaryFile' object has no attribute 'getvalue'
======================================================================
FAIL: test_post_with_unnamed_value (trac.web.tests.api.RequestTestCase.test_post_with_unnamed_value)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jun66j5/src/tracdev/git/trac/web/tests/api.py", line 560, in test_post_with_unnamed_value
self.assertEqual('named value', req.args['foo'])
^^^^^^^^
File "/home/jun66j5/src/tracdev/git/trac/web/api.py", line 689, in __getattr__
value = self.callbacks[name](self)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jun66j5/src/tracdev/git/trac/web/api.py", line 671, in <lambda>
'args': lambda req: arg_list_to_args(req.arg_list),
^^^^^^^^^^^^
File "/home/jun66j5/src/tracdev/git/trac/web/api.py", line 689, in __getattr__
value = self.callbacks[name](self)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jun66j5/src/tracdev/git/trac/web/api.py", line 1046, in _parse_arg_list
return list(parse_form_data(self.environ))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jun66j5/src/tracdev/git/trac/web/api.py", line 535, in parse_form_data
forms, files = multipart.parse_form_data(environ, charset='utf-8',
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jun66j5/venv/py312/lib/python3.12/site-packages/multipart.py", line 790, in parse_form_data
for part in MultipartParser(stream, boundary, content_length, **kwargs):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jun66j5/venv/py312/lib/python3.12/site-packages/multipart.py", line 596, in __iter__
for part in self._part_iter:
^^^^^^^^^^^^^^^
File "/home/jun66j5/venv/py312/lib/python3.12/site-packages/multipart.py", line 634, in _iterparse
for event in parser.parse(read(bufsize)):
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jun66j5/venv/py312/lib/python3.12/site-packages/multipart.py", line 347, in parse
self._current._update_size(index - offset)
File "/home/jun66j5/venv/py312/lib/python3.12/site-packages/multipart.py", line 493, in _update_size
assert self.name and not self.complete
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError
----------------------------------------------------------------------
Ran 2806 tests in 33.783s
FAILED (failures=1, errors=2, skipped=5)
Attachments (0)
Change History (2)
comment:1 by , 13 months ago
comment:2 by , 13 months ago
| Release Notes: | modified (diff) |
|---|---|
| Resolution: | → fixed |
| Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.



I'm guessing to be a defect of multipart module. I've filed it at https://github.com/defnull/multipart/issues/56.
Also, I'll plan to add
multipart!=1.0.0because of no workaround….setup.cfg
; python_version>='3.13'