Files
postgrest/test/io/test_sanity.py
T
c1d9728dc8 test(pytest): move pytest fixtures to conftest.py
There are a few benefits for this:

  - All fixtures in one module, so single source of truth.

  - The fixtures are automatically imported and injected by pytest
    so no explicit imports needed for these.

  - Linters won't complain about redefinition of outer scope objects.

Co-authored-by: Jens Troeger <jens.troeger@light-speed.de>
Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
2025-10-08 13:54:32 -05:00

27 lines
790 B
Python

"Sanity checks for the PostgREST black box testing infrastructure."
import pytest
from util import *
from postgrest import *
def test_port_connection(defaultenv):
"Connections via a port on localhost should work."
with run(env=defaultenv, port=freeport()):
pass
def test_plain_get(defaultenv):
"run() should give a working PostgREST."
with run(env=defaultenv) as postgrest:
response = postgrest.session.get("/projects")
assert response.status_code == 200
def test_no_pool_connection_available(defaultenv):
"no_pool_connection_available option is functional"
with run(env=defaultenv, no_pool_connection_available=True) as postgrest:
with pytest.raises(Exception) as e:
postgrest.session.get("/projects", timeout=1)