Пример #1
0
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]
Пример #2
0
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]
Пример #3
0
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()
Пример #4
0
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()
Пример #5
0
 def tearDown(self):
     sqlahelper.reset()
     shutil.rmtree(self.dir, True)
Пример #6
0
 def tearDown(self):
     sqlahelper.reset()
     shutil.rmtree(self.dir, True)
Пример #7
0
 def tearDown(self):
     self.config.end()
     # After calling ``self.config.end()``, don't use config.
     self.session = None
     sqlahelper.reset()