Commits

prologic  committed 9422e21

Moved tests to ../tests/

  • Participants
  • Parent commits 40317e1

Comments (0)

Files changed (9)

File pymills/tests/__init__.py

-# Module:	__init__
-# Date:		04th August 2004
-# Author:	James Mills, prologic at shortcircuit dot net dot au
-
-"""Teste Suite
-
-Test Suite for pymills. This will test every module
-in pymills. As much as possible, all functionality
-is tested in each module.
-"""

File pymills/tests/main.py

-#!/usr/bin/env python
-# Module:	main
-# Date:		1st October 2008
-# Author:	James Mills, prologic at shortcircuit dot net dot au
-
-"""Main
-
-Main Entry Point to run all the tests in the test suite.
-"""
-
-import re
-import os
-import sys
-import os.path
-import unittest
-
-def suite():
-	suite = unittest.TestSuite()
-
-	p = re.compile("^test_[a-z]+\.py$")
-	files = (x for x in os.listdir(os.path.dirname(__file__)) if p.match(x))
-	tests = ("pymills.tests.%s" % x.split(".")[0] for x in files)
-
-	for test in tests:
-		m = __import__(test, fromlist=["pymills.tests"])
-		suite.addTest(m.suite())
-
-	return suite
-
-def main():
-	unittest.main(defaultTest="suite")
-
-if __name__ == "__main__":
-	main()

File pymills/tests/test_db.py

-# Module:	db
-# Date:		27th December 2007
-# Author:	James Mills, prologic at shortcircuit dot net dot au
-
-"""DB Test Suite
-
-Test all functionality of the db library.
-"""
-
-import unittest
-
-from pymills.db import newDB, DriverError
-
-class DBTestCase(unittest.TestCase):
-
-	def testSQLite(self):
-		"""Test SQLite Sessions
-
-		Tests the database library using SQLite Sessions.
-		"""
-
-		try:
-			db = newDB("sqlite://:memory:")
-		except DriverError:
-			self.assertTrue(True)
-			return
-
-		x = db.do("create table names (firstname, lastname)")
-		self.assertEquals(x, [])
-		x = db.do("insert into names values ('James', 'Mills')")
-		self.assertEquals(x, [])
-		x = db.do("insert into names values ('Danny', 'Rawlins')")
-		self.assertEquals(x, [])
-		rows = db.do("select firstname, lastname from names")
-		self.assertEquals(rows[0].firstname, "James")
-		self.assertEquals(rows[0].lastname, "Mills")
-
-def suite():
-	return unittest.makeSuite(DBTestCase, "test")
-
-if __name__ == "__main__":
-	unittest.main()

File pymills/tests/test_emailtools.py

-# Module:	utils
-# Date:		5th March 2008
-# Author:	James Mills, prologic at shortcircuit dot net dot au
-
-"""Email Tools Test Suite
-
-Test all functionality of the Email Tools library.
-"""
-
-import socket
-import unittest
-
-from pymills.emailtools import Email
-
-class EmailToolsTestCase(unittest.TestCase):
-
-	def test_Email(self):
-		"""Test Email class
-
-		Test the Email class
-		"""
-
-		fd = open("/tmp/foo", "w")
-		fd.write("This is a test file.")
-		fd.close()
-
-		sender = "root@localhost"
-		recipient = "root@localhost"
-		subject = "Test"
-		body = "This is a test email."
-		file = "/tmp/foo"
-		filename = "foo.txt"
-
-		try:
-			email = Email(sender, recipient, subject)
-			email.add(body)
-			email.add(file=file, attach=True, filename=filename)
-			email.send()
-		except socket.error, e:
-			pass
-
-def suite():
-	return unittest.makeSuite(EmailToolsTestCase, "test")
-
-if __name__ == "__main__":
-	unittest.main()

File pymills/tests/test_utils.py

-# Module:	utils
-# Date:		14th January 2008
-# Author:	James Mills, prologic at shortcircuit dot net dot au
-
-"""Utils Test Suite
-
-Test all functionality of the Utils library.
-"""
-
-import unittest
-
-from pymills.utils import notags, getProgName 
-
-class UtilsTestCase(unittest.TestCase):
-
-	def test_notags(self):
-		"""Test notags functions
-
-		Test the "notags" function.
-		"""
-
-		x = "<html>foo</html>"
-		y = "foo"
-		self.assertEquals(notags(x), y)
-
-	def test_getProgName(self):
-		"""Test getProgName functions
-
-		Test the "getProgName" function.
-		"""
-
-		self.assertEquals(getProgName(), "nosetests")
-
-def suite():
-	return unittest.makeSuite(UtilsTestCase, "test")
-
-if __name__ == "__main__":
-	unittest.main()

File tests/main.py

+#!/usr/bin/env python
+# Module:	main
+# Date:		1st October 2008
+# Author:	James Mills, prologic at shortcircuit dot net dot au
+
+"""Main
+
+Main Entry Point to run all the tests in the test suite.
+"""
+
+import re
+import os
+import sys
+import os.path
+import unittest
+
+def suite():
+	suite = unittest.TestSuite()
+
+	p = re.compile("^test_[a-z]+\.py$")
+	files = (x for x in os.listdir(os.path.dirname(__file__)) if p.match(x))
+	tests = ("pymills.tests.%s" % x.split(".")[0] for x in files)
+
+	for test in tests:
+		m = __import__(test, fromlist=["pymills.tests"])
+		suite.addTest(m.suite())
+
+	return suite
+
+def main():
+	unittest.main(defaultTest="suite")
+
+if __name__ == "__main__":
+	main()

File tests/test_db.py

+# Module:	db
+# Date:		27th December 2007
+# Author:	James Mills, prologic at shortcircuit dot net dot au
+
+"""DB Test Suite
+
+Test all functionality of the db library.
+"""
+
+import unittest
+
+from pymills.db import newDB, DriverError
+
+class DBTestCase(unittest.TestCase):
+
+	def testSQLite(self):
+		"""Test SQLite Sessions
+
+		Tests the database library using SQLite Sessions.
+		"""
+
+		try:
+			db = newDB("sqlite://:memory:")
+		except DriverError:
+			self.assertTrue(True)
+			return
+
+		x = db.do("create table names (firstname, lastname)")
+		self.assertEquals(x, [])
+		x = db.do("insert into names values ('James', 'Mills')")
+		self.assertEquals(x, [])
+		x = db.do("insert into names values ('Danny', 'Rawlins')")
+		self.assertEquals(x, [])
+		rows = db.do("select firstname, lastname from names")
+		self.assertEquals(rows[0].firstname, "James")
+		self.assertEquals(rows[0].lastname, "Mills")
+
+def suite():
+	return unittest.makeSuite(DBTestCase, "test")
+
+if __name__ == "__main__":
+	unittest.main()

File tests/test_emailtools.py

+# Module:	utils
+# Date:		5th March 2008
+# Author:	James Mills, prologic at shortcircuit dot net dot au
+
+"""Email Tools Test Suite
+
+Test all functionality of the Email Tools library.
+"""
+
+import socket
+import unittest
+
+from pymills.emailtools import Email
+
+class EmailToolsTestCase(unittest.TestCase):
+
+	def test_Email(self):
+		"""Test Email class
+
+		Test the Email class
+		"""
+
+		fd = open("/tmp/foo", "w")
+		fd.write("This is a test file.")
+		fd.close()
+
+		sender = "root@localhost"
+		recipient = "root@localhost"
+		subject = "Test"
+		body = "This is a test email."
+		file = "/tmp/foo"
+		filename = "foo.txt"
+
+		try:
+			email = Email(sender, recipient, subject)
+			email.add(body)
+			email.add(file=file, attach=True, filename=filename)
+			email.send()
+		except socket.error, e:
+			pass
+
+def suite():
+	return unittest.makeSuite(EmailToolsTestCase, "test")
+
+if __name__ == "__main__":
+	unittest.main()

File tests/test_utils.py

+# Module:	utils
+# Date:		14th January 2008
+# Author:	James Mills, prologic at shortcircuit dot net dot au
+
+"""Utils Test Suite
+
+Test all functionality of the Utils library.
+"""
+
+import unittest
+
+from pymills.utils import notags, getProgName 
+
+class UtilsTestCase(unittest.TestCase):
+
+	def test_notags(self):
+		"""Test notags functions
+
+		Test the "notags" function.
+		"""
+
+		x = "<html>foo</html>"
+		y = "foo"
+		self.assertEquals(notags(x), y)
+
+	def test_getProgName(self):
+		"""Test getProgName functions
+
+		Test the "getProgName" function.
+		"""
+
+		self.assertEquals(getProgName(), "nosetests")
+
+def suite():
+	return unittest.makeSuite(UtilsTestCase, "test")
+
+if __name__ == "__main__":
+	unittest.main()