#9988 closed defect (fixed)
test_multiple_cookies fails with python 2.4.3
| Reported by: | Jun Omae | Owned by: | Remy Blank |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.12.2 |
| Component: | general | Version: | 0.12-stable |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
test_multiple_cookies fails with python 2.4.3. It passes with python 2.5.2 and 2.6.4.
It seems that Cookie.BaseCookie is different between 2.4.3 and 2.5.2.
Python 2.4.3
jun66j5@gotanda:1012$ python
Python 2.4.3 (#1, Nov 11 2010, 13:34:43)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from Cookie import BaseCookie
>>> str(BaseCookie('key=value'))
'Set-Cookie: key=value;'
Python 2.5.2
jun66j5@localhost:326$ python
Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from Cookie import BaseCookie
>>> str(BaseCookie('key=value'))
'Set-Cookie: key=value'
jun66j5@gotanda:999$ make unit-test
Python version: Python 2.4.3
figleaf:
coverage:
PYTHONPATH=.:
TRAC_TEST_DB_URI=
server-options= -p 8000 -r -e
python setup.py egg_info
running egg_info
writing requirements to Trac.egg-info/requires.txt
writing Trac.egg-info/PKG-INFO
writing top-level names to Trac.egg-info/top_level.txt
writing dependency_links to Trac.egg-info/dependency_links.txt
writing entry points to Trac.egg-info/entry_points.txt
writing manifest file 'Trac.egg-info/SOURCES.txt'
python ./trac/test.py --skip-functional-tests
.........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................F.............................................................................................................................................................................................................................................................................................................................................................................................................
======================================================================
FAIL: test_multiple_cookies (trac.web.tests.api.RequestTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jun66j5/src/trac/0.12-stable/trac/web/tests/api.py", line 119, in test_multiple_cookies
self.assertEqual('Set-Cookie: key=value1', str(req.incookie))
AssertionError: 'Set-Cookie: key=value1' != 'Set-Cookie: key=value1;'
----------------------------------------------------------------------
Ran 1127 tests in 46.697s
FAILED (failures=1)
make: *** [unit-test] Error 1
Attachments (0)
Change History (6)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:3 by , 15 years ago
| Owner: | set to |
|---|
follow-up: 5 comment:4 by , 15 years ago
Was [10450] really necessary? As we don't support 2.4 there I think it's OK if the test remains in its original, stricter, form.
follow-up: 6 comment:5 by , 15 years ago
Replying to cboos:
Was [10450] really necessary? As we don't support 2.4 there I think it's OK if the test remains in its original, stricter, form.
It wasn't absolutely necessary, but I remember thinking that the test was a bit sensitive to small changes in the serialization, and this issue was a confirmation. The "stricter" form doesn't buy anything anyway, as both serializations are valid. So I prefer the "weaker" form.
comment:6 by , 15 years ago
Replying to rblank:
… The "stricter" form doesn't buy anything anyway, as both serializations are valid.
Ah, I see. Thanks for the explanation!



Right, so they changed the serialization of cookies after 2.4. The following patch should make the test pass with both variants:
trac/web/tests/api.py