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:
Daniel Hahler 2018-12-11 14:09:09 +01:00 committed by Tom Christie
parent d96f1f32b3
commit d978bd4eef
1 changed files with 4 additions and 1 deletions

View File

@ -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()