diff --git a/tests/unit/test_roledb.py b/tests/unit/test_roledb.py index 6d068054..baecab91 100755 --- a/tests/unit/test_roledb.py +++ b/tests/unit/test_roledb.py @@ -38,7 +38,7 @@ class TestRoledb(unittest.TestCase): def setUp(self): - pass + pass @@ -403,6 +403,21 @@ def _test_rolename(self, test_function): +def setUpModule(): + # setUpModule is called before any test cases run. + # Ensure the roledb has not been modified by a previous test, which may + # affect assumptions (i.e., empty roledb) made by the tests cases in this + # unit test. + tuf.roledb.clear_roledb() + +def tearDownModule(): + # tearDownModule is called after all the tests have run. + # Ensure we clean up roledb. Courtesy is contagious, and it begins with + # test_roledb.py. + tuf.roledb.clear_roledb() + + + # Run the unit tests. if __name__ == '__main__': unittest.main()