From 7c7b1b1a928752158517f5c301659631376c53e1 Mon Sep 17 00:00:00 2001 From: Keith Erskine Date: Thu, 21 Jan 2021 21:54:53 -0600 Subject: [PATCH] move travis code to correct func --- tests3/pgtests.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/tests3/pgtests.py b/tests3/pgtests.py index 8defc3f4..fdf99218 100755 --- a/tests3/pgtests.py +++ b/tests3/pgtests.py @@ -622,7 +622,15 @@ def test_emoticons_as_literal(self): result = self.cursor.execute("select s from t1").fetchone()[0] - self.assertEqual(result, v) + if os.getenv('CI') == 'true' and os.getenv('TRAVIS') == 'true': + # On the current Travis CI platform (i.e. Ubuntu), this test generates the wrong + # result, which appears to be a PostgreSQL issue. A bug report has been raised + # with PostgreSQL: https://www.postgresql.org/message-id/16469-11c82a64f17f51f4%40postgresql.org + # Nevertheless, the result is predictable so we will still test for that incorrect value. + # This ensures the build passes and if this behavior ever changes, we will know about it. + self.assertEqual(result, v.encode('utf-8').decode('latin-1')) + else: + self.assertEqual(result, v) def test_cursor_messages(self): """ @@ -652,15 +660,6 @@ def test_cursor_messages(self): self.assertTrue(type(self.cursor.messages[0][1]) is str) self.assertEqual('[01000] (-1)', self.cursor.messages[0][0]) self.assertTrue(self.cursor.messages[0][1].endswith('hello world')) - if os.getenv('CI') == 'true' and os.getenv('TRAVIS') == 'true': - # On the current Travis CI platform (i.e. Ubuntu), this test generates the wrong - # result, which appears to be a PostgreSQL issue. A bug report has been raised - # with PostgreSQL: https://www.postgresql.org/message-id/16469-11c82a64f17f51f4%40postgresql.org - # Nevertheless, the result is predictable so we will still test for that incorrect value. - # This ensures the build passes and if this behavior ever changes, we will know about it. - self.assertEqual(result, v.encode('utf-8').decode('latin-1')) - else: - self.assertEqual(result, v) def test_output_conversion(self): # Note the use of SQL_WVARCHAR, not SQL_VARCHAR.