.. method:: BaseEventLoop.get_debug()
- Get the debug mode (:class:`bool`) of the event loop, ``False`` by default.
+ Get the debug mode (:class:`bool`) of the event loop.
+
+ The default value is ``True`` if the environment variable
+ :envvar:`PYTHONASYNCIODEBUG` is set to a non-empty string, ``False``
+ otherwise.
.. versionadded:: 3.4.2
self._running = False
self._clock_resolution = time.get_clock_info('monotonic').resolution
self._exception_handler = None
- self._debug = False
+ self._debug = (not sys.flags.ignore_environment
+ and bool(os.environ.get('PYTHONASYNCIODEBUG')))
# In debug mode, if the execution of a callback or a step of a task
# exceed this duration in seconds, the slow callback/task is logged.
self.slow_callback_duration = 0.1
self.assertEqual(2, sys.getrefcount(self.protocol),
pprint.pformat(gc.get_referrers(self.protocol)))
self.assertIsNone(tr._loop)
- self.assertEqual(3, sys.getrefcount(self.loop),
- pprint.pformat(gc.get_referrers(self.loop)))
class SelectorSocketTransportTests(test_utils.TestCase):
policy = asyncio.get_event_loop_policy()
self.loop = policy.new_event_loop()
- # ensure that the event loop is passed explicitly in the code
+ # ensure that the event loop is passed explicitly in asyncio
policy.set_event_loop(None)
watcher = self.Watcher()
policy = asyncio.get_event_loop_policy()
self.loop = asyncio.ProactorEventLoop()
- # ensure that the event loop is passed explicitly in the code
+ # ensure that the event loop is passed explicitly in asyncio
policy.set_event_loop(None)
def tearDown(self):
self.assertEqual(2, sys.getrefcount(self.protocol),
pprint.pformat(gc.get_referrers(self.protocol)))
self.assertIsNone(tr._loop)
- self.assertEqual(5, sys.getrefcount(self.loop),
- pprint.pformat(gc.get_referrers(self.loop)))
def test__call_connection_lost_with_err(self):
tr = unix_events._UnixReadPipeTransport(
self.assertEqual(2, sys.getrefcount(self.protocol),
pprint.pformat(gc.get_referrers(self.protocol)))
self.assertIsNone(tr._loop)
- self.assertEqual(5, sys.getrefcount(self.loop),
- pprint.pformat(gc.get_referrers(self.loop)))
class UnixWritePipeTransportTests(test_utils.TestCase):
self.assertEqual(2, sys.getrefcount(self.protocol),
pprint.pformat(gc.get_referrers(self.protocol)))
self.assertIsNone(tr._loop)
- self.assertEqual(5, sys.getrefcount(self.loop),
- pprint.pformat(gc.get_referrers(self.loop)))
def test__call_connection_lost_with_err(self):
tr = unix_events._UnixWritePipeTransport(
self.assertEqual(2, sys.getrefcount(self.protocol),
pprint.pformat(gc.get_referrers(self.protocol)))
self.assertIsNone(tr._loop)
- self.assertEqual(5, sys.getrefcount(self.loop),
- pprint.pformat(gc.get_referrers(self.loop)))
def test_close(self):
tr = unix_events._UnixWritePipeTransport(