summaryrefslogtreecommitdiff
path: root/test/runtests.py
diff options
context:
space:
mode:
authornitromaster101 <nitromaster101@5914aa95-5b3a-0410-a3b5-7b719e7fe9b2>2009-07-09 01:36:29 +0000
committernitromaster101 <nitromaster101@5914aa95-5b3a-0410-a3b5-7b719e7fe9b2>2009-07-09 01:36:29 +0000
commit637b2c5788657535ab05b6610f3b02d56ab957ec (patch)
treee774b101c86e33e2fab7afaf9feec161b799edf5 /test/runtests.py
parent8e71e49ea3708c30a4a0d3688cc9d643665d68be (diff)
add upload/revert schema manipulation, more tests, and other changes of the past few days
git-svn-id: http://freebase-python.googlecode.com/svn/trunk@172 5914aa95-5b3a-0410-a3b5-7b719e7fe9b2
Diffstat (limited to 'test/runtests.py')
-rw-r--r--test/runtests.py67
1 files changed, 67 insertions, 0 deletions
diff --git a/test/runtests.py b/test/runtests.py
new file mode 100644
index 0000000..add2380
--- /dev/null
+++ b/test/runtests.py
@@ -0,0 +1,67 @@
+import unittest
+
+import os
+import os.path
+
+import freebase
+
+def main():
+ created = False
+ passwordfile = "test/.password.txt"
+
+ # setup password stuff
+ if not os.path.isfile(passwordfile):
+ created = True
+ USERNAME, PASSWORD = "", ""
+ print "RUNTESTSIn order to run the tests, we need to use a valid freebase username and password"
+ USERNAME = raw_input("Please enter your username: ")
+ PASSWORD = raw_input("Please enter your password (it'll appear in cleartext): ")
+
+ freebase.login(USERNAME, PASSWORD)
+
+ print "Thanks!"
+ fh = open(passwordfile, "w")
+ fh.write(USERNAME + "\n" + PASSWORD)
+ fh.close()
+
+ # run tests
+ import test_freebase
+ import test_schema_manipulation
+
+ # test_freebase.TestFreebase,
+ testcases = [test_schema_manipulation.TestSchemaManipulation, test_freebase.TestFreebase]
+ testcases_dumb = [test_freebase.TestFreebase, test_schema_manipulation.TestSchemaManipulation]
+
+
+ suites = [unittest.TestLoader().loadTestsFromTestCase(x)
+ for x in testcases]
+
+
+ suites_dumb = [unittest.TestLoader().loadTestsFromTestCase(x)
+ for x in testcases_dumb]
+
+ print sorted(suites)
+ print sorted(suites_dumb)
+ print sorted(suites) == sorted(suites_dumb)
+
+ print
+
+ print "SUITES", suites
+
+
+ s1 = unittest.TestLoader().loadTestsFromTestCase(test_freebase.TestFreebase)
+ s2 = unittest.TestLoader().loadTestsFromTestCase(test_schema_manipulation.TestSchemaManipulation)
+
+ anotherrun = unittest.TestSuite([s1, s2])
+
+ #run = unittest.TestSuite(suites)
+
+ # delete password stuff
+
+ if created: os.remove(passwordfile)
+
+ return anotherrun
+
+
+if __name__ == '__main__':
+ main() \ No newline at end of file