Created
February 14, 2018 13:50
-
-
Save knil-sama/95afeb99ab6dad6d34ab596c71317732 to your computer and use it in GitHub Desktop.
Automated test suite in python unittest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
from tests.test_aggregation_logic import AggregationLogicTestCase | |
from tests.test_api_mock import TestApi | |
from tests.test_commons import CommonsTestCase | |
def listing_test_class(suite: unittest.TestSuite, test_class): | |
[suite.addTest(test_class(func)) for func in dir(test_class) if func.startswith("test_")] | |
return suite | |
def suite(): | |
suite = unittest.TestSuite() | |
suite = listing_test_class(suite, AggregationLogicTestCase) | |
suite = listing_test_class(suite, TestApi) | |
suite = listing_test_class(suite, CommonsTestCase) | |
return suite | |
if __name__ == '__main__': | |
runner = unittest.TextTestRunner() | |
test_suite = suite() | |
runner.run(test_suite) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment