From 127e46a76470dae391cce16d2c8aeede06cd253d Mon Sep 17 00:00:00 2001 From: pavel-zotov Date: Sun, 5 Mar 2023 17:50:00 +0300 Subject: [PATCH] Added/Updated tests\bugs\gh_7167_test.py: re-implemented in order to run both on Windows and Linux. See notes. --- tests/bugs/gh_7167_test.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/bugs/gh_7167_test.py b/tests/bugs/gh_7167_test.py index 71814ba6..4c50e11e 100644 --- a/tests/bugs/gh_7167_test.py +++ b/tests/bugs/gh_7167_test.py @@ -7,23 +7,28 @@ TITLE: Incorrect transliteration of field names in constraint violation er DESCRIPTION: NOTES: [28.02.2023] pzotov - Confirmed bug on 4.0.1.2692. - Checked on 5.0.0.961, 4.0.3.2903 - all OK. + Confirmed bug on 4.0.1.2692 Windows and Linux. + NB: on Linux we have to write SQL script into file with encoding = cp1251 + and run it as script, otherwise issue not reproduced. + + Checked on Windows and Linux, builds 5.0.0.961, 4.0.3.2903 - all OK. """ import pytest from firebird.qa import * +from pathlib import Path +import time db = db_factory(charset = 'win1251') -act = python_act('db') - +act = python_act('db', substitutions = [('After line \\d+ in file .*', '')]) +tmp_sql = temp_file('tmp_gh_7167.tmp.sql') expected_stdout = """ Statement failed, SQLSTATE = 23000 violation of PRIMARY or UNIQUE KEY constraint "уни" on table "абв" -Problematic key value is ("аб" = 'аб', "вг" = 'аб', "де" = 'аб') """ @pytest.mark.version('>=4.0.2') -def test_1(act: Action): +def test_1(act: Action, tmp_sql: Path): test_sql = """ create table "абв" ( "аб" varchar(5) character set win1251, @@ -34,6 +39,7 @@ def test_1(act: Action): insert into "абв" values ('аб','аб','аб'); insert into "абв" values ('аб','аб','аб'); """ + tmp_sql.write_bytes(test_sql.encode('cp1251')) act.expected_stdout = expected_stdout - act.isql(switches=['-q'], charset = 'win1251', input = test_sql, combine_output = True) + act.isql(switches=['-q'], charset = 'win1251', input_file = tmp_sql, combine_output = True) assert act.clean_stdout == act.clean_expected_stdout