[e988c2]: / tests / unit / backends / test_emis.py

Download this file

27 lines (23 with data), 951 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import pytest
from trino import exceptions as trino_exceptions
from ehrql.backends.emis import EMISBackend
@pytest.mark.parametrize(
"exception",
[
# These are trino errors that we may want to support in future with
# custom exit codes, but currently inherit from the base method
# Database errors
trino_exceptions.DatabaseError,
# OperationError is a subclass of DatabaseError
trino_exceptions.OperationalError,
# TrinoQueryError is encountered for over-complex/over-nested queries
trino_exceptions.TrinoQueryError,
# TrinoUserError is encountered for out of range numbers
trino_exceptions.TrinoUserError,
# TrinoUserError is encountered for bad/out of range dates
trino_exceptions.TrinoDataError,
],
)
def test_backend_exceptions(exception):
backend = EMISBackend()
assert backend.get_exit_status_for_exception(exception) is None