From: Daniele Varrazzo Date: Fri, 22 May 2020 17:14:54 +0000 (+1200) Subject: Use severity instead on severity_nonlocalized in tests X-Git-Tag: 3.0.dev0~500 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=eafc377d19943849e6c22039770b0c0061091fe9;p=thirdparty%2Fpsycopg.git Use severity instead on severity_nonlocalized in tests The attr is not available on PG 9.5 --- diff --git a/tests/test_async_connection.py b/tests/test_async_connection.py index 6aa10317d..c6d5e544a 100644 --- a/tests/test_async_connection.py +++ b/tests/test_async_connection.py @@ -282,9 +282,7 @@ def test_notice_handlers(aconn, loop, caplog): aconn.add_notice_handler(cb1) aconn.add_notice_handler(cb2) aconn.add_notice_handler("the wrong thing") - aconn.add_notice_handler( - lambda diag: severities.append(diag.severity_nonlocalized) - ) + aconn.add_notice_handler(lambda diag: severities.append(diag.severity)) aconn.pgconn.exec_(b"set client_min_messages to notice") cur = aconn.cursor() diff --git a/tests/test_connection.py b/tests/test_connection.py index c6a5af76d..67a450c15 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -266,9 +266,7 @@ def test_notice_handlers(conn, caplog): conn.add_notice_handler(cb1) conn.add_notice_handler(cb2) conn.add_notice_handler("the wrong thing") - conn.add_notice_handler( - lambda diag: severities.append(diag.severity_nonlocalized) - ) + conn.add_notice_handler(lambda diag: severities.append(diag.severity)) conn.pgconn.exec_(b"set client_min_messages to notice") cur = conn.cursor() diff --git a/tests/test_errors.py b/tests/test_errors.py index 8a01da6e4..ee76f7e4f 100644 --- a/tests/test_errors.py +++ b/tests/test_errors.py @@ -12,7 +12,7 @@ def test_error_diag(conn): exc = excinfo.value diag = exc.diag assert diag.sqlstate == "42P01" - assert diag.severity_nonlocalized == "ERROR" + assert diag.severity == "ERROR" def test_diag_all_attrs(pgconn, pq):