Adding Travis support.

This commit is contained in:
Antoine Nguyen
2013-11-08 13:50:45 +01:00
parent e5fba5541d
commit 1fc330c28a
2 changed files with 18 additions and 13 deletions
+15
View File
@@ -0,0 +1,15 @@
language: python
python:
- "2.6"
- "2.7"
services: mysql
install:
- python setup.py -q install
before_script:
- mysql -e 'create database modoboa_test;'
script:
- PYTHONPATH=tests python -m unittest install_from_scratch
+3 -13
View File
@@ -12,27 +12,17 @@ class DeployTest(unittest.TestCase):
dbtype = "mysql"
dbhost = "localhost"
projname = "modoboa_test"
dbuser = "root"
dbpassword = "toto"
dbuser = "travis"
dbpassword = ""
def setUp(self):
cmd = "mysqladmin -u %s -p%s create %s" % (self.dbuser, self.dbpassword, self.projname)
code, out = exec_cmd(cmd)
self.assertEqual(code, 0)
self.workdir = tempfile.mkdtemp()
def tearDown(self):
path = os.path.join(self.workdir, self.projname)
code, output = exec_cmd("python manage.py test lib admin limits", cwd=path)
code, output = exec_cmd("python manage.py test lib admin limits postfix_relay_domains", cwd=path)
self.assertEqual(code, 0)
if hasattr(self, "workdir"):
shutil.rmtree(self.workdir)
child = pexpect.spawn("mysqladmin -u root -p%s drop %s" % (self.dbpassword, self.projname))
child.expect("\[y/N\]")
child.sendline("y")
child.expect('Database "%s" dropped' % self.projname)
def test_standard(self):
timeout = 2
cmd = "modoboa-admin.py deploy --syncdb --collectstatic %s" % self.projname