def setUp(self): """The environment must contain PG* environment variables to establish a PostgreSQL connection: http://www.postgresql.org/docs/current/static/libpq-envars.html """ parser = pgtool.make_argparser() pgtool.args = parser.parse_args(["kill", "x"]) # hack :( self.db = pgtool.connect(None)
def setUpClass(cls): """The environment must contain PG* environment variables to establish a PostgreSQL connection: http://www.postgresql.org/docs/current/static/libpq-envars.html """ parser = pgtool.make_argparser() pgtool.args = parser.parse_args(["kill", "x"]) # hack to fill out args cls.db = pgtool.connect(None) c = cls.db.cursor() # XXX ideally this setup should be done once globally, not for each test class # language=SQL c.execute( """\ -- Schema DROP SCHEMA IF EXISTS pgtool_test CASCADE; CREATE SCHEMA pgtool_test; SET search_path=pgtool_test; -- Reindex test CREATE TABLE reindex_tbl (txt text); INSERT INTO reindex_tbl VALUES ('a'); """ )