Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tests/constraintstests.py
diff options
context:
space:
mode:
authorCharlie <charlie@tutorius-dev.(none)>2009-10-25 01:18:10 (GMT)
committer Charlie <charlie@tutorius-dev.(none)>2009-10-25 01:18:10 (GMT)
commit48ba2db44bb2054222cad3aca3e027e24c51c090 (patch)
tree13a25552db428a3a97e22e09f7936c4a988f11cf /tests/constraintstests.py
parent2b4eaea8f46e846799595b3c7015f77c6156532b (diff)
parentaa4868af13437f4718e8ce7972b79b496d296068 (diff)
Merge branch 'demo' into activity
Diffstat (limited to 'tests/constraintstests.py')
-rw-r--r--tests/constraintstests.py15
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()