Make various asyncio test files individually runnable

This commit is contained in:
Antoine Pitrou 2013-10-20 21:02:53 +02:00
parent bcd76827f4
commit cb1fe98f76
8 changed files with 32 additions and 0 deletions

View File

@ -588,3 +588,7 @@ class BaseEventLoopWithSelectorTests(unittest.TestCase):
self.loop._accept_connection(MyProto, sock)
self.assertTrue(sock.close.called)
self.assertTrue(m_log.exception.called)
if __name__ == '__main__':
unittest.main()

View File

@ -478,3 +478,7 @@ class BaseProactorEventLoopTests(unittest.TestCase):
self.loop._stop_serving(sock)
self.assertTrue(sock.close.called)
self.proactor._stop_serving.assert_called_with(sock)
if __name__ == '__main__':
unittest.main()

View File

@ -1483,3 +1483,7 @@ class SelectorDatagramTransportTests(unittest.TestCase):
transport._fatal_error(err)
self.protocol.connection_refused.assert_called_with(err)
m_exc.assert_called_with('Fatal error for %s', transport)
if __name__ == '__main__':
unittest.main()

View File

@ -143,3 +143,7 @@ class BaseSelectorTests(unittest.TestCase):
if hasattr(selectors.DefaultSelector, 'fileno'):
def test_fileno(self):
self.assertIsInstance(selectors.DefaultSelector().fileno(), int)
if __name__ == '__main__':
unittest.main()

View File

@ -53,3 +53,7 @@ class TransportTests(unittest.TestCase):
self.assertRaises(NotImplementedError, transport.send_signal, 1)
self.assertRaises(NotImplementedError, transport.terminate)
self.assertRaises(NotImplementedError, transport.kill)
if __name__ == '__main__':
unittest.main()

View File

@ -768,3 +768,7 @@ class UnixWritePipeTransportTests(unittest.TestCase):
tr.write_eof()
self.assertTrue(tr._closing)
self.assertFalse(self.protocol.connection_lost.called)
if __name__ == '__main__':
unittest.main()

View File

@ -93,3 +93,7 @@ class ProactorTests(unittest.TestCase):
protocols.Protocol, ADDRESS)
return 'done'
if __name__ == '__main__':
unittest.main()

View File

@ -138,3 +138,7 @@ class PopenTests(unittest.TestCase):
# allow for partial reads...
self.assertTrue(msg.upper().rstrip().startswith(out))
self.assertTrue(b"stderr".startswith(err))
if __name__ == '__main__':
unittest.main()