mirror of
https://github.com/FirebirdSQL/firebird-qa.git
synced 2025-01-22 13:33:07 +01:00
Added/Updated tests\bugs\core_1018_test.py: replaced code that parses obtained engine version: removed dependency on concrete major version.
This commit is contained in:
parent
b0afe2e25a
commit
87d7334d20
@ -12,84 +12,28 @@ FBTEST: bugs.core_1018
|
||||
import pytest
|
||||
from firebird.qa import *
|
||||
|
||||
# version: 3.0
|
||||
|
||||
db = db_factory()
|
||||
|
||||
test_script_1 = """
|
||||
test_script = """
|
||||
set list on;
|
||||
-- Engine version could contain more than one digit in any section or more sections.
|
||||
-- Changed pattern for matching such cases of engine version as:
|
||||
-- '3.2.23' or '3.3.2.1.0.1.2.3.4.5.7' etc
|
||||
select iif( t.ev similar to '[0-9]+.[0-9]+.[0-9]+((.?[0-9]+)*)', substring(ev from 1 for 3), null) as version
|
||||
select iif( t.ev similar to '[1-9]+.[[:DIGIT:]]+.[[:DIGIT:]]+((.?[[:DIGIT:]]+)*)', 'PRESENTS', null) as version
|
||||
from (
|
||||
select rdb$get_context('SYSTEM', 'ENGINE_VERSION') ev
|
||||
from rdb$database
|
||||
)t;
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db', test_script_1)
|
||||
act = isql_act('db', test_script, substitutions = [ ('[ \\t]+', ' ') ] )
|
||||
|
||||
expected_stdout_1 = """
|
||||
VERSION 3.0
|
||||
expected_stdout = """
|
||||
VERSION PRESENTS
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0,<4.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
|
||||
# version: 4.0
|
||||
|
||||
test_script_2 = """
|
||||
set list on;
|
||||
-- Engine version could contain more than one digit in any section or more sections.
|
||||
-- Changed pattern for matching such cases of engine version as:
|
||||
-- '3.2.23' or '3.3.2.1.0.1.2.3.4.5.7' etc
|
||||
select iif( t.ev similar to '[0-9]+.[0-9]+.[0-9]+((.?[0-9]+)*)', substring(ev from 1 for 3), null) as version
|
||||
from (
|
||||
select rdb$get_context('SYSTEM', 'ENGINE_VERSION') ev
|
||||
from rdb$database
|
||||
)t;
|
||||
"""
|
||||
|
||||
act_2 = isql_act('db', test_script_2, substitutions=[('4\\.\\d+', '4\\.')]
|
||||
)
|
||||
|
||||
expected_stdout_2 = """
|
||||
VERSION 4.0
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=4.0,<5.0')
|
||||
def test_2(act_2: Action):
|
||||
act_2.expected_stdout = expected_stdout_2
|
||||
act_2.execute()
|
||||
assert act_2.clean_stdout == act_2.clean_expected_stdout
|
||||
|
||||
# version: 5.0
|
||||
|
||||
test_script_3 = """
|
||||
set list on;
|
||||
-- Engine version could contain more than one digit in any section or more sections.
|
||||
-- Changed pattern for matching such cases of engine version as:
|
||||
-- '3.2.23' or '3.3.2.1.0.1.2.3.4.5.7' etc
|
||||
select iif( t.ev similar to '[0-9]+.[0-9]+.[0-9]+((.?[0-9]+)*)', substring(ev from 1 for 3), null) as version
|
||||
from (
|
||||
select rdb$get_context('SYSTEM', 'ENGINE_VERSION') ev
|
||||
from rdb$database
|
||||
)t;
|
||||
"""
|
||||
|
||||
act_3 = isql_act('db', test_script_3, substitutions=[('5\\.\\d+', '5\\.')])
|
||||
|
||||
expected_stdout_3 = """
|
||||
VERSION 5.0
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=5.0')
|
||||
def test_3(act_3: Action):
|
||||
act_3.expected_stdout = expected_stdout_3
|
||||
act_3.execute()
|
||||
assert act_3.clean_stdout == act_3.clean_expected_stdout
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_3(act: Action):
|
||||
act.expected_stdout = expected_stdout
|
||||
act.execute()
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
Loading…
Reference in New Issue
Block a user