diff options
author | mike <michael.jmontcalm@gmail.com> | 2009-10-19 04:38:32 (GMT) |
---|---|---|
committer | mike <michael.jmontcalm@gmail.com> | 2009-10-19 04:38:32 (GMT) |
commit | 6584510d390a37153c20974da6704a907058fea0 (patch) | |
tree | a0649a77b36b63885774e0af25ec752192a5c404 /tests/constraintstests.py | |
parent | 2aef185e57f6c6c38670a5eea74f7889b3d56944 (diff) | |
parent | 3b9bff2ef1826987d95815ff03c235052cea9aae (diff) |
Merge gitorious@git.sugarlabs.org:tutorius/michaeljm-dev into merge_michaeljm-dev
Diffstat (limited to 'tests/constraintstests.py')
-rw-r--r-- | tests/constraintstests.py | 15 |
1 files changed, 13 insertions, 2 deletions
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() |