def setUpClass(cls): TestCase.setUpClass() if not isinstance(cls.SERVICES, tuple): if isinstance(cls.SERVICES, string_types): cls.SERVICES = (cls.SERVICES,) else: cls.SERVICES = tuple(cls.SERVICES) tmp_dir = Path(tempfile.mkdtemp(prefix='tmp-py-unittest-', suffix='-' + cls.__name__,)) cls.TEST_INSTANCE_PATH = str(tmp_dir) for p in (tmp_dir/'tmp', tmp_dir/'cache', tmp_dir/'data'): p.mkdir() sa_warn = 'error' if cls.SQLALCHEMY_WARNINGS_AS_ERROR else 'default' warnings.simplefilter(sa_warn, SAWarning)