mirror of
https://github.com/FirebirdSQL/firebird-qa.git
synced 2025-01-22 13:33:07 +01:00
Merge branch 'master' of https://github.com/FirebirdSQL/firebird-qa
This commit is contained in:
commit
8044f703df
@ -912,6 +912,9 @@ How to use users
|
||||
How to use roles
|
||||
----------------
|
||||
|
||||
How to use temporary files
|
||||
--------------------------
|
||||
|
||||
.. _Python: http://www.python.org
|
||||
.. _virtualenv: https://virtualenv.pypa.io/en/latest/
|
||||
.. _virtualenvwrapper: https://virtualenvwrapper.rtfd.io
|
||||
|
@ -488,12 +488,15 @@ class Database:
|
||||
Do not create instances of this class directly! Use **only** fixtures created by `db_factory`.
|
||||
"""
|
||||
def __init__(self, path: Path, filename: str, user: str=None, password: str=None,
|
||||
charset: str=None, debug: str='', config_name: str='pytest'):
|
||||
charset: str=None, debug: str='', config_name: str='pytest',
|
||||
utf8filename: bool=False):
|
||||
#: firebird-driver database configuration name
|
||||
self.config_name: str = config_name
|
||||
if driver_config.get_database(config_name) is None:
|
||||
driver_config.register_database(config_name)
|
||||
self._debug: str = debug
|
||||
#: Use utf8_filename DPB flag
|
||||
self.utf8filename = utf8filename
|
||||
#: Full path to test database.
|
||||
self.db_path: Path = path / filename
|
||||
#: DSN to test database.
|
||||
@ -532,6 +535,7 @@ class Database:
|
||||
db_conf.database.value = str(self.db_path)
|
||||
db_conf.user.value = self.user if user is None else user
|
||||
db_conf.password.value = self.password if password is None else password
|
||||
db_conf.utf8filename.value = self.utf8filename
|
||||
if sql_dialect is not None:
|
||||
db_conf.db_sql_dialect.value = sql_dialect
|
||||
db_conf.sql_dialect.value = sql_dialect
|
||||
@ -710,7 +714,7 @@ def db_factory(*, filename: str='test.fdb', init: str=None, from_backup: str=Non
|
||||
copy_of: str=None, page_size: int=None, sql_dialect: int=None,
|
||||
charset: str=None, user: str=None, password: str=None,
|
||||
do_not_create: bool=False, do_not_drop: bool=False, async_write: bool=True,
|
||||
config_name: str='pytest'):
|
||||
config_name: str='pytest', utf8filename: bool=False):
|
||||
"""Factory function that returns :doc:`fixture <pytest:explanation/fixtures>` providing
|
||||
the `Database` instance.
|
||||
|
||||
@ -735,6 +739,7 @@ def db_factory(*, filename: str='test.fdb', init: str=None, from_backup: str=Non
|
||||
option when test database is removed by test itself (as part of test routine).
|
||||
async_write: When `True` [default], the database is set to async write before initialization.
|
||||
config_name: Name for database configuration.
|
||||
utf8filename: Use utf8filename DPB flag.
|
||||
|
||||
.. note::
|
||||
|
||||
@ -745,7 +750,8 @@ def db_factory(*, filename: str='test.fdb', init: str=None, from_backup: str=Non
|
||||
|
||||
@pytest.fixture
|
||||
def database_fixture(request: pytest.FixtureRequest, db_path) -> Database:
|
||||
db = Database(db_path, filename, user, password, charset, debug=str(request.module))
|
||||
db = Database(db_path, filename, user, password, charset, debug=str(request.module),
|
||||
config_name=config_name, utf8filename=utf8filename)
|
||||
if not do_not_create:
|
||||
if from_backup is None and copy_of is None:
|
||||
db.create(page_size, sql_dialect)
|
||||
|
@ -60,13 +60,7 @@ expected_stdout = """
|
||||
@pytest.mark.skip("Can't be implement with new Python driver")
|
||||
@pytest.mark.version('>=3')
|
||||
def test_1(act: Action, tmp_user: User):
|
||||
# 1. Try to specifying 'force_write' flag: no errors and NO changes in 2.1.1; error in 2.1.2 and above
|
||||
act.db._make_config(user=tmp_user.name, password=tmp_user.password)
|
||||
db_conf = driver_config.get_database('pytest')
|
||||
db_conf.forced_writes.value = True
|
||||
with pytest.raises():
|
||||
connect('pytest')
|
||||
# 2. Try to specifying 'no_reserve' flag: no errors and NO changes in 2.1.1; error in 2.1.2 and above
|
||||
pass
|
||||
|
||||
# test_script_1
|
||||
#---
|
||||
|
Loading…
Reference in New Issue
Block a user