Fix fixture for older versions
This commit is contained in:
parent
df5a7d198f
commit
1813413b33
|
@ -3,16 +3,25 @@ import factory
|
||||||
|
|
||||||
from factory.alchemy import SQLAlchemyModelFactory
|
from factory.alchemy import SQLAlchemyModelFactory
|
||||||
from pytest_factoryboy import register
|
from pytest_factoryboy import register
|
||||||
|
from ckan.plugins import toolkit
|
||||||
|
|
||||||
import ckan.model as model
|
import ckan.model as model
|
||||||
|
|
||||||
from ckanext.googleanalytics.model import PackageStats, ResourceStats
|
from ckanext.googleanalytics.model import PackageStats, ResourceStats
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture()
|
if toolkit.requires_ckan_version("2.9"):
|
||||||
def clean_db(reset_db, migrate_db_for):
|
@pytest.fixture()
|
||||||
reset_db()
|
def clean_db(reset_db, migrate_db_for):
|
||||||
migrate_db_for("googleanalytics")
|
reset_db()
|
||||||
|
migrate_db_for("googleanalytics")
|
||||||
|
else:
|
||||||
|
from dbutil import init_tables
|
||||||
|
@pytest.fixture()
|
||||||
|
def clean_db(reset_db):
|
||||||
|
reset_db()
|
||||||
|
init_tables()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@register
|
@register
|
||||||
|
|
Loading…
Reference in New Issue