Opened 14 years ago
Closed 14 years ago
#16447 closed Bug (fixed)
settings_changed signal uses strings for sender
| Reported by: | Alex Gaynor | Owned by: | nobody |
|---|---|---|---|
| Component: | Testing framework | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Since internally the sender is represented by the id() this is not valid, because there's no guarntee 2 strings of the same value have the same id(). This reproduces easily with PyPy:
alex@alex-gaynor-laptop:~/projects/django$ PYTHONPATH=`pwd` ~/projects/pypy/pypy-c tests/runtests.py --settings=test_sqlite settings_tests --failfast
Creating test database for alias 'default'...
Creating test database for alias 'other'...
...........F
======================================================================
FAIL: test_signal_callback_context_manager (regressiontests.settings_tests.tests.SettingsTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/alex/projects/django/tests/regressiontests/settings_tests/tests.py", line 80, in test_signal_callback_context_manager
self.assertEqual(testvalue, 'override')
AssertionError: None != 'override'
----------------------------------------------------------------------
Ran 12 tests in 0.004s
FAILED (failures=1)
Destroying test database for alias 'default'...
Destroying test database for alias 'other'...
but it would also be possible to reproduce with CPython.
Note:
See TracTickets
for help on using tickets.
In [16530]: