Opened 5 months ago

Last modified 5 months ago

#29187 new Bug

test_delete_signals occasionally fails when running all django tests

Reported by: Jacob Mulford Owned by: nobody
Component: Core (Other) Version: 2.0
Severity: Normal Keywords: tests, unit tests
Cc: Triage Stage: Someday/Maybe
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm unable to replicate this consistently (outside of random chance) but occasionally test_delete_signals fails with the following error message when running all of the django tests:

(djangodev) jakemulf@jakemulf-Aspire-E5-574G:~/projects/open_source_projects/django$ python tests/runtests.py 
Testing against Django installed in '/home/jakemulf/projects/open_source_projects/django/django' with up to 4 processes
Creating test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Creating test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
System check identified no issues (14 silenced).
.....................................................................................................................................................................................................................................................................................................................................x......................................................................................................................................................................................................s..........s.......ss..................................s..............................................................................................s.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................sssssssssssssssssssssssssssssssssssss.............................................sss..s...........................................s.............................................................................................................s......................................................................................................................................................................................s....................................................................s..s......................s.............................................s..............s..............................................................s.................................................s.s.......s.s.......................................................................s..............................................................................................................................................................................................s....................................................sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss.F.....sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss..s..sssss............................s................................s.....................................................................................................s........ssss................................s.....s.s..........................................s.......................................................................s......s........................................s.........s....................................................................sssss.....................................................................................................................................................................s.............sss.........................................................................................................................ssssssssssss.............................................................................................................................................................................................................................................s......s......................sss.s....s.............................x..s..............x.............................................................................................s..........................................................................................................s.....................................................................................................s........................................................................................................................................................................................s.............................................................................................ssssssssssssssssssssssssss......................s.......ss............................................................................................................................s......................................................................................................................................................s.......................................................................................................................................................................sssssssssssssssssssssssssssssssssssssssssssssssssssssss.......ssssssssssssssssssssssssssssssssssssssssssssssssssssss.............................................................................................................................................................................................................................s........................................................................ssssss..............................................................................................................................................................................................................................s.....s...ssssssssssssssssssssss..........................................................................................................................................................................s..................................................................s............s..s.....ss.ssss.....ss.s......s...........s....s....................................s.........s...............ss.........................................................................................................................................................sss..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................s.......................................................................................................................................................................................................................................................................................................................................................................................ss...................................................................................................................................ssssss......................................................................................................................................................................s.................................................................................................................................................................................................................................................................s..s.......................................................................................................................................................s...................................................s........................................................................................................sss.sssssssssss.....s...s..........s.................................................................................................................................................................s..............................................................................................................s..............ss............................sssssss..sssss..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................s....ssssssssss..............................sss......s............................s................ss...ss...s.s...........................................................................................................s.............s...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................s.............................................................................................................................................................................................s............................................................................x.............................ss...........................................................................sssssssssss.s.sssss.ssssss.........................................................................................................................ssssssss.....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
======================================================================
FAIL: test_delete_signals (signals.tests.SignalTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.5/unittest/case.py", line 58, in testPartExecutor
    yield
  File "/usr/lib/python3.5/unittest/case.py", line 603, in run
    self.tearDown()
  File "/home/jakemulf/projects/open_source_projects/django/tests/signals/tests.py", line 32, in tearDown
    self.assertEqual(self.pre_signals, post_signals)
  File "/usr/lib/python3.5/unittest/case.py", line 820, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/usr/lib/python3.5/unittest/case.py", line 1029, in assertTupleEqual
    self.assertSequenceEqual(tuple1, tuple2, msg, seq_type=tuple)
  File "/usr/lib/python3.5/unittest/case.py", line 1000, in assertSequenceEqual
    self.fail(msg)
  File "/usr/lib/python3.5/unittest/case.py", line 665, in fail
    raise self.failureException(msg)
AssertionError: Tuples differ: (1, 0, 2, 1) != (1, 0, 2, 0)

First differing element 3:
1
0

- (1, 0, 2, 1)
?           ^

+ (1, 0, 2, 0)
?           ^


----------------------------------------------------------------------
Ran 12143 tests in 135.413s

FAILED (failures=1, skipped=804, expected failures=4)
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'other'...
Destroying test database for alias 'other'...
Destroying test database for alias 'other'...
Destroying test database for alias 'other'...
Destroying test database for alias 'other'...
(djangodev) jakemulf@jakemulf-Aspire-E5-574G:~/projects/open_source_projects/django$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
(djangodev) jakemulf@jakemulf-Aspire-E5-574G:~/projects/open_source_projects/django$ python
Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Running the same test command again passes all tests.

I have not yet gotten the same error when isolating these signal tests (python tests/runtests.py signals.tests.SignalTests)

Change History (2)

comment:1 Changed 5 months ago by Jacob Mulford

I added a print statement in 'tests/signals/tests.py' to see the difference between 'signals.pre_delete.receivers' and 'signals.post_delete.receivers' and noticed that they were not the same when running all of the unit tests compared to running just the 'signals.tests.SignalTests' tests.

Isolating the signals.tests.SignalTests unit tests

(djangodev) jakemulf@jakemulf-Aspire-E5-574G:~/projects/open_source_projects/django$ python tests/runtests.py signals.tests.SignalTests
Testing against Django installed in '/home/jakemulf/projects/open_source_projects/django/django' with up to 4 processes
Creating test database for alias 'default'...
Creating test database for alias 'other'...
System check identified no issues (0 silenced).
[((140297206139216, 37859832), <weakref at 0x7f997d224f48; to 'function' at 0x7f997d228950 (clear_site_cache)>)]
[]
.[((140297206139216, 37859832), <weakref at 0x7f997d224f48; to 'function' at 0x7f997d228950 (clear_site_cache)>)]
[]
.[((140297206139216, 37859832), <weakref at 0x7f997d224f48; to 'function' at 0x7f997d228950 (clear_site_cache)>)]
[]
.[((140297206139216, 37859832), <weakref at 0x7f997d224f48; to 'function' at 0x7f997d228950 (clear_site_cache)>)]
[]
.[((140297206139216, 37859832), <weakref at 0x7f997d224f48; to 'function' at 0x7f997d228950 (clear_site_cache)>)]
[]
.[((140297206139216, 37859832), <weakref at 0x7f997d224f48; to 'function' at 0x7f997d228950 (clear_site_cache)>)]
[]
.[((140297206139216, 37859832), <weakref at 0x7f997d224f48; to 'function' at 0x7f997d228950 (clear_site_cache)>)]
[]
.
----------------------------------------------------------------------
Ran 7 tests in 0.016s

OK
Destroying test database for alias 'default'...
Destroying test database for alias 'other'...
(djangodev) jakemulf@jakemulf-Aspire-E5-574G:~/projects/open_source_projects/django$ 

Running all unit tests with success

(djangodev) jakemulf@jakemulf-Aspire-E5-574G:~/projects/open_source_projects/django$ python tests/runtests.py
Testing against Django installed in '/home/jakemulf/projects/open_source_projects/django/django' with up to 4 processes
Creating test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Creating test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
System check identified no issues (14 silenced).
.....................................................................................................................................................................................................................................................................................................................................x................................................................................................................................................................................................................s.................................ss..s......................................s...................................s..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................sssssssssssssssssssssssssssssssssssss.............................................sss..s...........................................s...................................................................................................s................................................................................................................................................................................................s..........................................................s..s................................s...........................s.......................................................................s.s.......s.s........................s.......................s................................................................................................s................................................................................................................................................................................................................s....................[((139835895023952, 32229800), <weakref at 0x7f2e14d94ef8; to 'function' at 0x7f2e14d98950 (clear_site_cache)>), ((139835874889240, 39580856), <weakref at 0x7f2e139f43b8; to 'function' at 0x7f2e13a64e18 (prevent_deletes)>)]
[]
[((139835895023952, 32229800), <weakref at 0x7f2e14d94ef8; to 'function' at 0x7f2e14d98950 (clear_site_cache)>), ((139835874889240, 39580856), <weakref at 0x7f2e139f43b8; to 'function' at 0x7f2e13a64e18 (prevent_deletes)>)]
[]
[((139835895023952, 32229800), <weakref at 0x7f2e14d94ef8; to 'function' at 0x7f2e14d98950 (clear_site_cache)>), ((139835874889240, 39580856), <weakref at 0x7f2e139f43b8; to 'function' at 0x7f2e13a64e18 (prevent_deletes)>)]
[]
[((139835895023952, 32229800), <weakref at 0x7f2e14d94ef8; to 'function' at 0x7f2e14d98950 (clear_site_cache)>), ((139835874889240, 39580856), <weakref at 0x7f2e139f43b8; to 'function' at 0x7f2e13a64e18 (prevent_deletes)>)]
[]
[((139835895023952, 32229800), <weakref at 0x7f2e14d94ef8; to 'function' at 0x7f2e14d98950 (clear_site_cache)>), ((139835874889240, 39580856), <weakref at 0x7f2e139f43b8; to 'function' at 0x7f2e13a64e18 (prevent_deletes)>)]
[]
.....[((139835895023952, 32229800), <weakref at 0x7f2e14d94ef8; to 'function' at 0x7f2e14d98950 (clear_site_cache)>), ((139835874889240, 39580856), <weakref at 0x7f2e139f43b8; to 'function' at 0x7f2e13a64e18 (prevent_deletes)>)]
[]
[((139835895023952, 32229800), <weakref at 0x7f2e14d94ef8; to 'function' at 0x7f2e14d98950 (clear_site_cache)>), ((139835874889240, 39580856), <weakref at 0x7f2e139f43b8; to 'function' at 0x7f2e13a64e18 (prevent_deletes)>)]
[]
[((139835895023952, 32229800), <weakref at 0x7f2e14d94ef8; to 'function' at 0x7f2e14d98950 (clear_site_cache)>), ((139835874889240, 39580856), <weakref at 0x7f2e139f43b8; to 'function' at 0x7f2e13a64e18 (prevent_deletes)>)]
[]
[((139835895023952, 32229800), <weakref at 0x7f2e14d94ef8; to 'function' at 0x7f2e14d98950 (clear_site_cache)>), ((139835874889240, 39580856), <weakref at 0x7f2e139f43b8; to 'function' at 0x7f2e13a64e18 (prevent_deletes)>)]
[]
[((139835895023952, 32229800), <weakref at 0x7f2e14d94ef8; to 'function' at 0x7f2e14d98950 (clear_site_cache)>), ((139835874889240, 39580856), <weakref at 0x7f2e139f43b8; to 'function' at 0x7f2e13a64e18 (prevent_deletes)>)]
[]
.........sssssssssssss[((139835895023952, 32229800), <weakref at 0x7f2e14d94ef8; to 'function' at 0x7f2e14d98950 (clear_site_cache)>), ((139835874889240, 39580856), <weakref at 0x7f2e139f43b8; to 'function' at 0x7f2e13a64e18 (prevent_deletes)>)]
s[]
sssssssssssssssssssssssssssssssssssssssssssssssssssss[((139835895023952, 32229800), <weakref at 0x7f2e14d94ef8; to 'function' at 0x7f2e14d98950 (clear_site_cache)>), ((139835874889240, 39580856), <weakref at 0x7f2e139f43b8; to 'function' at 0x7f2e13a64e18 (prevent_deletes)>)]
[]
.......sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss..s..sssssssssssssssssssssssssssss............................s...........................................................................................................s.....................ssss.............................s................s.....s.s..........................................s......................................................................................s..................s.............s..s...........................................................................sssss.....................................................................................................................................................................s.............sss.........................................................................................................................ssssssssssss.............................................................................................................................................................................................................................................s......s.......s...............................x.................sss.s..s................x...........................................................................................s...............................................................................................................................................s.........................................................s...............................................................................................................................................................................................s.............................................................................................ssssssssssssssssssssssssss...................s......ss..................................................................................................................................................................s....................................................................................................................s.......................................................................................................................................................................sssssssssssssssssssssssssssssssssssssssssssssssssssssss.......ssssssssssssssssssssssssssssssssssssssssssssssssssssss.............................................................................................................................................................................................................................s........................................................................ssssss........................................................................................................................................................................s..........................s..ssssssssssssssssssssss............................................................................................................................................................................................................s..................................................s............s..s.....ss.ssss.....ss.s......s...........s....s....................................s.........s....................................ss....................................................................................................................................................sss.....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................s....................................................................................................................................................................................................................................................................................................................................................................................ss...........................................................................................................................................ssssss......................................................................................................................................................................s.............................................................................................................................................................................................................................................................s..s............................................................................................................................s...............................................................................s..........................s..........................................................................................................sss.sssssssssss...s...s....................................................................................................................................................s........................................................................................................s........................ss......sssssss..sssss................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................s....ssssssssss........................................................sss.s.......s................ss...ss...s.s...........................................................................................................s.............s...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................s................................................................................................................................sssssssssss.s.sssss.ssssss..........s............................................................................x.............................ss.......................................................................................................................................................................................................................................................ssssssss.....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 12143 tests in 126.068s

OK (skipped=804, expected failures=4)
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'other'...
Destroying test database for alias 'other'...
Destroying test database for alias 'other'...
Destroying test database for alias 'other'...
Destroying test database for alias 'other'...

Running all tests with failure on test_delete_signals

(djangodev) jakemulf@jakemulf-Aspire-E5-574G:~/projects/open_source_projects/django$ python tests/runtests.py
Testing against Django installed in '/home/jakemulf/projects/open_source_projects/django/django' with up to 4 processes
Creating test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Creating test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
System check identified no issues (14 silenced).
.....................................................................................................................................................................................................................................................................................................................................x....................................................................................................................................................................................s.s.........................................ss.........................................................s.........................................s..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................sssssssssssssssssssssssssssssssssssss.............................................sss..s...........................................s...................................................................................................s................................................................................................................................................................................................s................................................................................s..s....s...........................s...................................................s.s.......s.s..................................................s..................................s.......................................................................................s............................................................................................................................................................................................s......................................[((139947131390288, 38479880), <weakref at 0x7f47fb0d8ef8; to 'function' at 0x7f47fb0dc950 (clear_site_cache)>), ((139947111254080, 45829352), <weakref at 0x7f47f9d38408; to 'function' at 0x7f47f9da8840 (prevent_deletes)>)]
[((139946820203112, 47003928), <weakref at 0x7f47ead241d8; dead>)]
[((139947131390288, 38479880), <weakref at 0x7f47fb0d8ef8; to 'function' at 0x7f47fb0dc950 (clear_site_cache)>), ((139947111254080, 45829352), <weakref at 0x7f47f9d38408; to 'function' at 0x7f47f9da8840 (prevent_deletes)>)]
[((139946820203112, 47003928), <weakref at 0x7f47ead241d8; dead>)]
[((139947131390288, 38479880), <weakref at 0x7f47fb0d8ef8; to 'function' at 0x7f47fb0dc950 (clear_site_cache)>), ((139947111254080, 45829352), <weakref at 0x7f47f9d38408; to 'function' at 0x7f47f9da8840 (prevent_deletes)>)]
[((139946820203112, 47003928), <weakref at 0x7f47ead241d8; dead>)]
[((139947131390288, 38479880), <weakref at 0x7f47fb0d8ef8; to 'function' at 0x7f47fb0dc950 (clear_site_cache)>), ((139947111254080, 45829352), <weakref at 0x7f47f9d38408; to 'function' at 0x7f47f9da8840 (prevent_deletes)>)]
[((139946820203112, 47003928), <weakref at 0x7f47ead241d8; dead>)]
[((139947131390288, 38479880), <weakref at 0x7f47fb0d8ef8; to 'function' at 0x7f47fb0dc950 (clear_site_cache)>), ((139947111254080, 45829352), <weakref at 0x7f47f9d38408; to 'function' at 0x7f47f9da8840 (prevent_deletes)>)]
[((139946820203112, 47003928), <weakref at 0x7f47ead241d8; dead>)]
.....[((139947131390288, 38479880), <weakref at 0x7f47fb0d8ef8; to 'function' at 0x7f47fb0dc950 (clear_site_cache)>), ((139947111254080, 45829352), <weakref at 0x7f47f9d38408; to 'function' at 0x7f47f9da8840 (prevent_deletes)>)]
[((139946820203112, 47003928), <weakref at 0x7f47ead241d8; dead>)]
.........sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss[((139947131390288, 38479880), <weakref at 0x7f47fb0d8ef8; to 'function' at 0x7f47fb0dc950 (clear_site_cache)>), ((139947111254080, 45829352), <weakref at 0x7f47f9d38408; to 'function' at 0x7f47f9da8840 (prevent_deletes)>)]
[]
sssssssssssssssssssssss[((139947131390288, 38479880), <weakref at 0x7f47fb0d8ef8; to 'function' at 0x7f47fb0dc950 (clear_site_cache)>), ((139947111254080, 45829352), <weakref at 0x7f47f9d38408; to 'function' at 0x7f47f9da8840 (prevent_deletes)>)]
s[]
ssssss[((139947131390288, 38479880), <weakref at 0x7f47fb0d8ef8; to 'function' at 0x7f47fb0dc950 (clear_site_cache)>), ((139947111254080, 45829352), <weakref at 0x7f47f9d38408; to 'function' at 0x7f47f9da8840 (prevent_deletes)>)]
[]
ssss[((139947131390288, 38479880), <weakref at 0x7f47fb0d8ef8; to 'function' at 0x7f47fb0dc950 (clear_site_cache)>), ((139947111254080, 45829352), <weakref at 0x7f47f9d38408; to 'function' at 0x7f47f9da8840 (prevent_deletes)>)]
[]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss[((139947131390288, 38479880), <weakref at 0x7f47fb0d8ef8; to 'function' at 0x7f47fb0dc950 (clear_site_cache)>), ((139947111254080, 45829352), <weakref at 0x7f47f9d38408; to 'function' at 0x7f47f9da8840 (prevent_deletes)>)]
[]
sssssssssssssss[((139947131390288, 38479880), <weakref at 0x7f47fb0d8ef8; to 'function' at 0x7f47fb0dc950 (clear_site_cache)>), ((139947111254080, 45829352), <weakref at 0x7f47f9d38408; to 'function' at 0x7f47f9da8840 (prevent_deletes)>)]
[]
ssssssssssssssssssssssssssssssssssssssss.F.....sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss..s..............................s...........................................................................................................s..........................s........ssss................................s.....s.s..........................................s......................................................................................s..................s.............s...s..........................................................................sssss.....................................................................................................................................................................s.............sss.........................................................................................................................ssssssssssss.............................................................................................................................................................................................................................................s......s.......s...............................x....s..............x...................sss.s.........................................................................................s..................................................................................s......................................................s...............................................................................................................................................................................................................................................................s.............................................................................................ssssssssssssssssssssssssss...................s.........ss............................................................................................................................................................................................................................................................s.......................s.......................................................................................................................................................................sssssssssssssssssssssssssssssssssssssssssssssssssssssss.......ssssssssssssssssssssssssssssssssssssssssssssssssssssss.............................................................................................................................................................................................................................s........................................................................ssssss..............................................................................................................................................................................................................................s.....s....................ssssssssssssssssssssss..........................................................................................................................................................................s..................................................................................ss....................................................................................................................................................sss.............................................................................................................................................................................................................................................................................................................................................................................................................................s............s..s.....ss.ssss.....ss.s......s...........s....s....................................s.........s..............................................................................................................s..................................................................................................................................................................................................................................................................................................................................................................................ss..........................................................................................................................................ssssss...............................................................................................................................................................................s...............................................................................................................................................................................................................................................................s..s................................................................................................................................................s...................................................s...........................................................................................................sss.sssssssssss..s...s..............................................................................................................................s.............................................s........................................................................................................s........................ss......sssssss..sssss....................................................................................................................................................................................................................................................................................................................................................................................................................................................................s....ssssssssss....................................................................................ssss........s................ss...ss...s.s......................................................................................................s.............s................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................s....................................................................................................................................................................................sssssssssss.s.sssss.ssssss........s............................................................................x.............................ss................................................................................................................................................................................................ssssssss..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
======================================================================
FAIL: test_delete_signals (signals.tests.SignalTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.5/unittest/case.py", line 58, in testPartExecutor
    yield
  File "/usr/lib/python3.5/unittest/case.py", line 603, in run
    self.tearDown()
  File "/home/jakemulf/projects/open_source_projects/django/tests/signals/tests.py", line 34, in tearDown
    self.assertEqual(self.pre_signals, post_signals)
  File "/usr/lib/python3.5/unittest/case.py", line 820, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/usr/lib/python3.5/unittest/case.py", line 1029, in assertTupleEqual
    self.assertSequenceEqual(tuple1, tuple2, msg, seq_type=tuple)
  File "/usr/lib/python3.5/unittest/case.py", line 1000, in assertSequenceEqual
    self.fail(msg)
  File "/usr/lib/python3.5/unittest/case.py", line 665, in fail
    raise self.failureException(msg)
AssertionError: Tuples differ: (1, 0, 2, 1) != (1, 0, 2, 0)

First differing element 3:
1
0

- (1, 0, 2, 1)
?           ^

+ (1, 0, 2, 0)
?           ^


----------------------------------------------------------------------
Ran 12143 tests in 129.548s

FAILED (failures=1, skipped=804, expected failures=4)
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'other'...
Destroying test database for alias 'other'...
Destroying test database for alias 'other'...
Destroying test database for alias 'other'...
Destroying test database for alias 'other'...
(djangodev) jakemulf@jakemulf-Aspire-E5-574G:~/projects/open_source_projects/django$ 

It looks like the value in 'signals.post_delete.receivers' becomes a dead reference

[((139946820203112, 47003928), <weakref at 0x7f47ead241d8; dead>)]

The unit test still fails since the unit test is checking the length of the signals, and this dead reference is still counted in the length

    def setUp(self):
        # Save up the number of connected signals so that we can check at the
        # end that all the signals we register get properly unregistered (#9989)
        self.pre_signals = (
            len(signals.pre_save.receivers),
            len(signals.post_save.receivers),
            len(signals.pre_delete.receivers),
            len(signals.post_delete.receivers),
        )

    def tearDown(self):
        # All our signals got disconnected properly.
        post_signals = (
            len(signals.pre_save.receivers),
            len(signals.post_save.receivers),
            len(signals.pre_delete.receivers),
            len(signals.post_delete.receivers),
        )
        self.assertEqual(self.pre_signals, post_signals)

comment:2 Changed 5 months ago by Tim Graham

Component: Testing frameworkCore (Other)
Triage Stage: UnreviewedSomeday/Maybe

I haven't seen that failure before, but if someone identifies the cause, please let us know.

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