def setUp(self): logging.debug("Database SetUp") self.pgInstance = postgresql.Postgresql() dsn = self.pgInstance.dsn() self.SR.overrideUpdate("database.host", str(dsn["host"])) self.SR.overrideUpdate("database.port", str(dsn["port"])) self.SR.overrideUpdate("database.user", str(dsn["user"])) self.SR.overrideUpdate("database.name", str(dsn["database"])) super().setUp()
def setUp(self): try: self.postgresql = testing_postgresql.Postgresql() self.engine = sa.create_engine(self.postgresql.url()) self.engine_fail = None except Exception as e: self.postgresql = self.engine = None self.engine_fail = e if self.engine_fail: print(f"!!!!Engine failed to load due to {self.engine_fail}") if self.engine: for test_schema in test_schemas: if utils.safe_apply(lambda: test_schema in sa.inspect(self.engine).get_schema_names())(): self.engine.execute(sa.schema.DropSchema(test_schema, cascade=True))
def postgresql_start(): logging.info("starting PostgreSQL instance") instance = postgresql.Postgresql() logging.info("started %s" % db_uri(instance.dsn())) return instance
def setUp(self): self.postgresql = tps.Postgresql()