diff --git a/tests/models/test_units.py b/tests/models/test_units.py index af1cb219..121e77b5 100644 --- a/tests/models/test_units.py +++ b/tests/models/test_units.py @@ -1,7 +1,7 @@ """ Test for filip.models.units """ -from unittest import TestCase +import unittest import functools from filip.models.ngsi_v2.units import \ Unit, \ @@ -11,7 +11,7 @@ load_units -class TestUnitCodes(TestCase): +class TestUnitCodes(unittest.TestCase): def setUp(self): self.units_data = load_units() @@ -101,6 +101,16 @@ def test_unit_validator(self): Returns: None """ + + unit_data = self.unit.copy() + unit_data['name'] = "celcius" + with self.assertRaises(ValueError): + Unit(**unit_data) + + def tearDown(self): + """ + clean up + """ # using garbage collector to clean up all caches import gc gc.collect() @@ -113,8 +123,7 @@ def test_unit_validator(self): for object in objects: object.cache_clear() - unit_data = self.unit.copy() - unit_data['name'] = "celcius" - with self.assertRaises(ValueError): - Unit(**unit_data) +if __name__ == '__main__': + unittest.main() +