def tearDownCommon(): # if test.in does not exist (because the z3c.recipe.filetemplate # part hasn't been executed) then db_url is None if db_url is None: # pragma: nocover return # verify that we have a working database connection before going # forward from sqlalchemy import create_engine from sqlalchemy.exc import OperationalError engine = create_engine(db_url) try: engine.connect() except OperationalError: # pragma: nocover return from c2cgeoportal.models import Base Base.metadata.drop_all(checkfirst=True) import sqlahelper sqlahelper.reset() from c2cgeoportal import caching caching.invalidate_region() del caching._regions[None]
def tear_down_common(): functionality.FUNCTIONALITIES_TYPES = None # if test.in does not exist (because the z3c.recipe.filetemplate # part hasn't been executed) then db_url is None if db_url is None: # pragma: no cover return import sqlahelper sqlahelper.reset() # verify that we have a working database connection before going # forward from sqlalchemy import create_engine from sqlalchemy.exc import OperationalError engine = create_engine(db_url) try: engine.connect() except OperationalError: # pragma: no cover return import alembic.config import sys sys.argv = [ "alembic", "-c", "c2cgeoportal/tests/functional/alembic_static.ini", "downgrade", "base" ] try: alembic.config.main() except SystemExit: # alembic call the exit method! pass sys.argv = [ "alembic", "-c", "c2cgeoportal/tests/functional/alembic.ini", "downgrade", "base" ] try: alembic.config.main() except SystemExit: # alembic call the exit method! pass caching.invalidate_region()
def tear_down_common(): c2cgeoportal.lib.functionality.FUNCTIONALITIES_TYPES = None # if test.in does not exist (because the z3c.recipe.filetemplate # part hasn't been executed) then db_url is None if db_url is None: # pragma: no cover return # verify that we have a working database connection before going # forward from sqlalchemy import create_engine from sqlalchemy.exc import OperationalError engine = create_engine(db_url) try: engine.connect() except OperationalError: # pragma: no cover return import alembic.config import sys sys.argv = [ "alembic", "-c", "c2cgeoportal/tests/functional/alembic_static.ini", "downgrade", "base" ] try: alembic.config.main() except SystemExit: # alembic call the exit method! pass sys.argv = [ "alembic", "-c", "c2cgeoportal/tests/functional/alembic.ini", "downgrade", "base" ] try: alembic.config.main() except SystemExit: # alembic call the exit method! pass import sqlahelper sqlahelper.reset() c2cgeoportal.caching.invalidate_region()
def tearDown(self): sqlahelper.reset() shutil.rmtree(self.dir, True)
def tearDown(self): self.config.end() # After calling ``self.config.end()``, don't use config. self.session = None sqlahelper.reset()