Implements SharedTableProtocol against a ThreadedConnectionPool (psycopg2). SnipeSharedDB handles pool lifecycle and idempotent SQL migrations. save_sellers uses COALESCE to preserve existing account_age_days when the new record omits it. All 6 Postgres tests skip cleanly without SNIPE_SHARED_DB_URL.
17 lines
409 B
Python
17 lines
409 B
Python
import os
|
|
import pytest
|
|
|
|
|
|
def pytest_configure(config):
|
|
config.addinivalue_line(
|
|
"markers",
|
|
"postgres: mark test as requiring a live Postgres instance (SNIPE_SHARED_DB_URL must be set)",
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def postgres_dsn():
|
|
dsn = os.environ.get("SNIPE_SHARED_DB_URL")
|
|
if not dsn:
|
|
pytest.skip("SNIPE_SHARED_DB_URL not set — skipping Postgres tests")
|
|
return dsn
|