From cf40c1951f4f0f26090226fb4969ca147341a031 Mon Sep 17 00:00:00 2001 From: mike Date: Fri, 02 Oct 2009 22:24:56 +0000 Subject: LP 439980 : Refactored the XMLSerializer to support complex components; Corrected specs for the addons properties and constructor parameters names; Moved all existing actions and events to components (except a few left in code for testing purposes) --- (limited to 'tests/constraintstests.py') diff --git a/tests/constraintstests.py b/tests/constraintstests.py index b7b0a47..4e19a92 100644 --- a/tests/constraintstests.py +++ b/tests/constraintstests.py @@ -16,6 +16,9 @@ import unittest +import uuid +import os + from sugar.tutorius.constraints import * class ConstraintTest(unittest.TestCase): @@ -218,10 +221,18 @@ class EnumConstraintTest(unittest.TestCase): assert False, "Wrong exception type thrown" class FileConstraintTest(unittest.TestCase): + def setUp(self): + self.temp_filename = "sample_file_" + str(uuid.uuid1()) + ".txt" + self.file1 = file(self.temp_filename, "w") + self.file1.close() + + def tearDown(self): + os.unlink(self.temp_filename) + def test_validate(self): cons = FileConstraint() - cons.validate("run-tests.py") + cons.validate(self.temp_filename) try: cons.validate("unknown/file.py") @@ -230,4 +241,4 @@ class FileConstraintTest(unittest.TestCase): pass if __name__ == "__main__": - unittest.main() \ No newline at end of file + unittest.main() -- cgit v0.9.1