ogn-python/tests/model/all_classes.py

29 wiersze
682 B
Python
Czysty Zwykły widok Historia

import os
2019-11-24 15:24:45 +00:00
from enum import EnumMeta
2017-10-03 10:59:45 +00:00
import unittest
2017-12-13 13:22:31 +00:00
import inspect
2017-10-03 10:59:45 +00:00
2019-08-31 08:14:41 +00:00
os.environ["OGN_CONFIG_MODULE"] = "config/test.py"
2019-08-31 08:14:41 +00:00
import app.model # noqa: E402
2017-10-03 10:59:45 +00:00
class TestStringMethods(unittest.TestCase):
def test_string(self):
2019-11-24 15:24:45 +00:00
failures = 0
for name, obj in inspect.getmembers(app.model):
try:
if inspect.isclass(obj) and not isinstance(obj, EnumMeta):
2017-12-13 13:22:31 +00:00
print(obj())
2019-11-24 15:24:45 +00:00
except AttributeError as e:
print("Failed: {}".format(name))
failures += 1
if failures > 0:
raise AssertionError("Not all classes are good")
2017-10-03 10:59:45 +00:00
2019-08-31 08:14:41 +00:00
if __name__ == "__main__":
2017-10-03 10:59:45 +00:00
unittest.main()