mirror of
https://github.com/FirebirdSQL/firebird-qa.git
synced 2025-01-22 13:33:07 +01:00
Added/Updated tests\bugs\core_4578_test.py: re-implemented old test to be used in new QA.
This commit is contained in:
parent
4ca464540b
commit
ba8a5a513b
@ -5,72 +5,57 @@ ID: issue-4894
|
|||||||
ISSUE: 4894
|
ISSUE: 4894
|
||||||
TITLE: INPUT file not properly closed
|
TITLE: INPUT file not properly closed
|
||||||
DESCRIPTION:
|
DESCRIPTION:
|
||||||
|
Test makes TWO attempts to execute script using 'IN <script>' command.
|
||||||
|
After first attempt (which must complete OK) we try to delete file using Windows 'DEL' command.
|
||||||
|
This command must finish successful and second attempt to run the same script must file with
|
||||||
|
message 'Unable to open ...'
|
||||||
|
|
||||||
JIRA: CORE-4578
|
JIRA: CORE-4578
|
||||||
FBTEST: bugs.core_4578
|
FBTEST: bugs.core_4578
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
import locale
|
||||||
import pytest
|
import pytest
|
||||||
from firebird.qa import *
|
from firebird.qa import *
|
||||||
db = db_factory()
|
|
||||||
|
|
||||||
|
init_sql = """
|
||||||
|
recreate table test(id bigint primary key);
|
||||||
|
commit;
|
||||||
|
"""
|
||||||
|
db = db_factory(init = init_sql)
|
||||||
act = python_act('db', substitutions=[('Unable to open.*', 'Unable to open')])
|
act = python_act('db', substitutions=[('Unable to open.*', 'Unable to open')])
|
||||||
|
|
||||||
expected_stdout = """
|
|
||||||
ID 1
|
|
||||||
Unable to open
|
|
||||||
"""
|
|
||||||
|
|
||||||
@pytest.mark.skip('FIXME: Not IMPLEMENTED')
|
tmp_worker = temp_file('tmp.core_4578.worker.sql')
|
||||||
|
tmp_caller = temp_file('tmp.core_4578.caller.sql')
|
||||||
|
|
||||||
@pytest.mark.version('>=3')
|
@pytest.mark.version('>=3')
|
||||||
@pytest.mark.platform('Windows')
|
@pytest.mark.platform('Windows')
|
||||||
def test_1(act: Action):
|
def test_1(act: Action, tmp_worker: Path, tmp_caller: Path):
|
||||||
pytest.fail("Not IMPLEMENTED")
|
|
||||||
|
|
||||||
# test_script_1
|
|
||||||
#---
|
worker_sql = """
|
||||||
#
|
set list on;
|
||||||
# import os
|
insert into test(id) values(1) returning id;
|
||||||
# import subprocess
|
commit;
|
||||||
# import time
|
"""
|
||||||
#
|
|
||||||
# db_conn.close()
|
caller_sql = f"""
|
||||||
#
|
set list on;
|
||||||
# txt_in = '''set list on;
|
commit;
|
||||||
# recreate table test(id int);
|
in "{str(tmp_worker)}";
|
||||||
# commit;
|
shell del "{str(tmp_worker)}";
|
||||||
# insert into test values(1);
|
in "{str(tmp_worker)}";
|
||||||
# select id from test;
|
"""
|
||||||
# commit;
|
tmp_worker.write_text(worker_sql)
|
||||||
# '''
|
tmp_caller.write_text(caller_sql)
|
||||||
# tmp_input_sql=open( os.path.join(context['temp_directory'],'tmp_4578_in.sql'), 'w')
|
|
||||||
# tmp_input_sql.write(txt_in)
|
expected_stdout = """
|
||||||
# tmp_input_sql.close()
|
ID 1
|
||||||
#
|
Unable to open
|
||||||
# sql_main_file=open( os.path.join(context['temp_directory'],'tmp_4578_go.sql'), 'w')
|
"""
|
||||||
#
|
act.expected_stdout = expected_stdout
|
||||||
# sql_main_file.write("set bail on;\\n" )
|
act.isql(switches=['-q'], input_file = str(tmp_caller), io_enc = locale.getpreferredencoding(), combine_output = True)
|
||||||
# sql_main_file.write("in "+tmp_input_sql.name+";\\n" )
|
|
||||||
# sql_main_file.write("shell del "+tmp_input_sql.name+" 2>nul;\\n" )
|
assert act.clean_stdout == act.clean_expected_stdout
|
||||||
# sql_main_file.write("in "+tmp_input_sql.name+";\\n" )
|
|
||||||
#
|
|
||||||
# sql_main_file.close()
|
|
||||||
#
|
|
||||||
# sql_main_log=open( os.path.join(context['temp_directory'],'tmp_isql_4578.log'), 'w')
|
|
||||||
# p_isql = subprocess.call([ "isql" , dsn, "-user" , "SYSDBA" , "-password", "masterkey", "-i", sql_main_file.name ], stdout=sql_main_log, stderr=subprocess.STDOUT)
|
|
||||||
# sql_main_log.close()
|
|
||||||
#
|
|
||||||
# time.sleep(1)
|
|
||||||
#
|
|
||||||
# with open( sql_main_log.name,'r') as f:
|
|
||||||
# print(f.read())
|
|
||||||
# f.close()
|
|
||||||
#
|
|
||||||
# # do NOT remove this pause otherwise log of trace will not be enable for deletion and test will finish with
|
|
||||||
# # Exception raised while executing Python test script. exception: WindowsError: 32
|
|
||||||
# time.sleep(1)
|
|
||||||
#
|
|
||||||
# os.remove(sql_main_log.name)
|
|
||||||
# os.remove(sql_main_file.name)
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#---
|
|
||||||
|
Loading…
Reference in New Issue
Block a user