Removing unnecessary setup of test database
We are already using pg arrays so the unpickle function in sql/tags.sql is not needed, at least by the moment. I'm removing it because it was entering in an infinite loop when creating the test database.remotes/origin/enhancement/email-actions
parent
a222b0d9f8
commit
e98d666a40
|
@ -16,10 +16,6 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import os.path
|
|
||||||
from functools import lru_cache
|
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
from .fixtures import *
|
from .fixtures import *
|
||||||
|
|
||||||
|
@ -31,18 +27,3 @@ def pytest_addoption(parser):
|
||||||
def pytest_runtest_setup(item):
|
def pytest_runtest_setup(item):
|
||||||
if "slow" in item.keywords and not item.config.getoption("--runslow"):
|
if "slow" in item.keywords and not item.config.getoption("--runslow"):
|
||||||
pytest.skip("need --runslow option to run")
|
pytest.skip("need --runslow option to run")
|
||||||
|
|
||||||
@lru_cache(maxsize=4)
|
|
||||||
def _get_sql():
|
|
||||||
path = os.path.join(settings.BASE_DIR, "sql", "tags.sql")
|
|
||||||
with open(path, "r") as f:
|
|
||||||
return f.read()
|
|
||||||
|
|
||||||
|
|
||||||
def on_db_connect(sender, connection, **kwargs):
|
|
||||||
cursor = connection.cursor()
|
|
||||||
cursor.execute(_get_sql())
|
|
||||||
|
|
||||||
|
|
||||||
from django.db.backends import signals
|
|
||||||
signals.connection_created.connect(on_db_connect)
|
|
||||||
|
|
Loading…
Reference in New Issue