With skipUnless there is no need to add test classes conditionally.

This commit is contained in:
Ezio Melotti 2010-07-27 22:24:13 +00:00
parent c47bd4a09a
commit 9a381c7a02

View file

@ -693,18 +693,15 @@ class BaseTestAPI(unittest.TestCase):
class TestAPI_UseSelect(BaseTestAPI):
use_poll = False
@unittest.skipUnless(hasattr(select, 'poll'), 'select.poll required')
class TestAPI_UsePoll(BaseTestAPI):
use_poll = True
def test_main():
tests = [HelperFunctionTests, DispatcherTests, DispatcherWithSendTests,
DispatcherWithSendTests_UsePoll, TestAPI_UseSelect]
if hasattr(asyncore, 'file_wrapper'):
tests.append(FileWrapperTest)
if hasattr(select, 'poll'):
tests.append(TestAPI_UsePoll)
DispatcherWithSendTests_UsePoll, TestAPI_UseSelect,
TestAPI_UsePoll, FileWrapperTest]
run_unittest(*tests)
if __name__ == "__main__":