Skip to content

Commit 2b706ee

Browse files
committed
Fix ProgrammingError in CI mode
1 parent 916724a commit 2b706ee

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

api/conftest.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
)
1515
from common.projects.permissions import VIEW_PROJECT
1616
from django.contrib.contenttypes.models import ContentType
17+
from django.contrib.postgres.signals import (
18+
register_type_handlers,
19+
)
1720
from django.core.cache import caches
21+
from django.db import connections
1822
from django.db.backends.base.creation import TEST_DATABASE_PREFIX
1923
from django.test.utils import setup_databases
2024
from flag_engine.segments.constants import EQUAL
@@ -135,6 +139,11 @@ def pytest_configure(config: pytest.Config) -> None:
135139
interactive=False,
136140
parallel=config.option.numprocesses,
137141
)
142+
# Ensure psycopg type handlers are registered.
143+
# This is necessary for tests that involve `HStoreField`.
144+
for connection in connections.all():
145+
if connection.vendor == "postgresql":
146+
register_type_handlers(connection)
138147

139148

140149
@pytest.fixture

0 commit comments

Comments
 (0)