Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#16925 closed Bug (fixed)

disconnect signal before checking test success

Reported by: adsworth Owned by: adsworth
Component: Python 3 Version: 1.3
Severity: Normal Keywords:
Cc: adsworth Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Disconnect the presave signal before calling assertEquals, in the test regressiontests.fixtures_regress.tests.TestFixtures.test_field_value_coerce
. If the test fails (as it currently does for Python 3) the pre_save signal stays connected and causes a multitude of later tests to error.

before fix:
Ran 4036 tests in 94.677s

FAILED (failures=505, errors=1375, skipped=56, expected failures=1, unexpected successes=1)

after fix:
Ran 4090 tests in 229.091s

FAILED (failures=600, errors=770, skipped=72, expected failures=2, unexpected successes=1)

Attachments (2)

fix-signal-disconnect.patch (729 bytes ) - added by adsworth 13 years ago.
16925.patch (1.3 KB ) - added by Aymeric Augustin 13 years ago.

Download all attachments as: .zip

Change History (5)

by adsworth, 13 years ago

Attachment: fix-signal-disconnect.patch added

comment:1 by Aymeric Augustin, 13 years ago

Triage Stage: UnreviewedAccepted

The best best way to ensure the signal gets disconnected is to use a try / finally. See attached patch.

I'm not sure how to run the tests under Python 3 — I checked out the py3k branch, but runtests.py fails with this error:

  File "runtests.py", line 118
    print "Importing application %s" % module_name
                                   ^
SyntaxError: invalid syntax

If the new patch works for you, feel free to mark the ticket as RFC.

by Aymeric Augustin, 13 years ago

Attachment: 16925.patch added

comment:2 by adsworth, 13 years ago

Triage Stage: AcceptedReady for checkin

The patch from aaugustin works fine in Python3.

To run the test in Python 3 you need at least 3.2 and then run the py3ktest script in the py3k branch.

comment:3 by Alex Gaynor, 13 years ago

Resolution: fixed
Status: newclosed

In [16905]:

Fixed #16925 -- Make sure a signal is disconnected if the test fails. Thanks to aaugustin for the patch.

Note: See TracTickets for help on using tickets.
Back to Top