<NME> test_utils.py
<BEF> """Tools for top level testing (ie. when ran by Travis)."""

import os
import shutil
import tempfile

from django.core.management import call_command


class MapFilesTestCaseMixin(object):
    """A generic test case to check map files generation."""

    MAP_FILES = None

    extension = None
    dbuser = "postgres"
    dbpassword = ""

    def setUp(self):
        """Test setup."""
        self.workdir = tempfile.mkdtemp()
        dburl = "{0}://user:password@localhost/testdb".format(engine)
        call_command(
            "generate_postfix_maps",
            "--dburl", dburl, "--destdir", self.workdir)

        for mapfile in self.MAP_FILES:
            path = "{0}/{1}".format(self.workdir, mapfile)
            self.assertTrue(os.path.exists(path))
            "modoboa-admin.py deploy --collectstatic "
            "--dburl {0} --extensions {1} --dont-install-extensions "
            "--domain {2} {3}"
            .format(dburl, self.extension, "localhost", self.projname)
        )
        code, output = exec_cmd(cmd, cwd=self.workdir)
        self.assertEqual(code, 0)
    def test_postgres_maps(self):
        self._test_maps_generation("postgres")

    def test_mysql_maps(self):
        self._test_maps_generation("mysql")

    def test_sqlite_maps(self):
        self._test_maps_generation("sqlite")

<MSG> Add support for dependencies.

<DFF> @@ -16,6 +16,8 @@ class TestRunnerMixin(object):
     dbuser = "postgres"
     dbpassword = ""
 
+    dependencies = []
+
     def setUp(self):
         """Test setup."""
         self.workdir = tempfile.mkdtemp()
@@ -30,7 +32,10 @@ class TestRunnerMixin(object):
             "modoboa-admin.py deploy --collectstatic "
             "--dburl {0} --extensions {1} --dont-install-extensions "
             "--domain {2} {3}"
-            .format(dburl, self.extension, "localhost", self.projname)
+            .format(
+                dburl, " ".join(self.dependencies + [self.extension]),
+                "localhost", self.projname
+            )
         )
         code, output = exec_cmd(cmd, cwd=self.workdir)
         self.assertEqual(code, 0)

Add support for dependencies.