'When the reactor has its shutdown event fired before it is run, the
thread pool is completely destroyed.
For what it\'s worth, the reason we support this behavior at all is
because Trial does this.
This is the case of the thread pool being created without the reactor
being started at al.'

def test_cleanUpThreadPoolEvenBeforeReactorIsRun(self):

    reactor = self.buildReactor()
    threadPoolRef = ref(reactor.getThreadPool())
    reactor.fireSystemEvent('shutdown')
    if (reactor.__class__.__name__ == 'AsyncioSelectorReactor'):
        self.assertIsNone(reactor.threadpool)
    else:
        gc.collect()
        self.assertIsNone(threadPoolRef())
