mirror of
https://github.com/django/daphne.git
synced 2025-07-04 20:03:07 +03:00
Fix issue with calling super setUp while test cases (#231)
This commit is contained in:
parent
efcf08d768
commit
b9519d112d
|
@ -26,11 +26,11 @@ class ChannelTestCase(TestCase):
|
||||||
# Customizable so users can test multi-layer setups
|
# Customizable so users can test multi-layer setups
|
||||||
test_channel_aliases = [DEFAULT_CHANNEL_LAYER]
|
test_channel_aliases = [DEFAULT_CHANNEL_LAYER]
|
||||||
|
|
||||||
def setUp(self):
|
def _pre_setup(self):
|
||||||
"""
|
"""
|
||||||
Initialises in memory channel layer for the duration of the test
|
Initialises in memory channel layer for the duration of the test
|
||||||
"""
|
"""
|
||||||
super(ChannelTestCase, self).setUp()
|
super(ChannelTestCase, self)._pre_setup()
|
||||||
self._old_layers = {}
|
self._old_layers = {}
|
||||||
for alias in self.test_channel_aliases:
|
for alias in self.test_channel_aliases:
|
||||||
# Swap in an in memory layer wrapper and keep the old one around
|
# Swap in an in memory layer wrapper and keep the old one around
|
||||||
|
@ -43,7 +43,7 @@ class ChannelTestCase(TestCase):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
def tearDown(self):
|
def _post_teardown(self):
|
||||||
"""
|
"""
|
||||||
Undoes the channel rerouting
|
Undoes the channel rerouting
|
||||||
"""
|
"""
|
||||||
|
@ -51,7 +51,7 @@ class ChannelTestCase(TestCase):
|
||||||
# Swap in an in memory layer wrapper and keep the old one around
|
# Swap in an in memory layer wrapper and keep the old one around
|
||||||
channel_layers.set(alias, self._old_layers[alias])
|
channel_layers.set(alias, self._old_layers[alias])
|
||||||
del self._old_layers
|
del self._old_layers
|
||||||
super(ChannelTestCase, self).tearDown()
|
super(ChannelTestCase, self)._post_teardown()
|
||||||
|
|
||||||
def get_next_message(self, channel, alias=DEFAULT_CHANNEL_LAYER, require=False):
|
def get_next_message(self, channel, alias=DEFAULT_CHANNEL_LAYER, require=False):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user