mirror of https://github.com/encode/starlette.git
tests: skip test_database without DATABASE_URL (#263)
* tests: skip test_database without DATABASE_URL (instead of causing a collection error) * fixup! tests: skip test_database without DATABASE_URL
This commit is contained in:
parent
d96f1f32b3
commit
d978bd4eef
|
@ -9,7 +9,10 @@ from starlette.middleware.database import DatabaseMiddleware
|
||||||
from starlette.responses import JSONResponse
|
from starlette.responses import JSONResponse
|
||||||
from starlette.testclient import TestClient
|
from starlette.testclient import TestClient
|
||||||
|
|
||||||
|
try:
|
||||||
DATABASE_URL = os.environ["STARLETTE_TEST_DATABASE"]
|
DATABASE_URL = os.environ["STARLETTE_TEST_DATABASE"]
|
||||||
|
except KeyError: # pragma: no cover
|
||||||
|
pytest.skip("DATABASE_URL is not set", allow_module_level=True)
|
||||||
|
|
||||||
metadata = sqlalchemy.MetaData()
|
metadata = sqlalchemy.MetaData()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue