Skip to content

Config replacement support#34

Merged
pcisar merged 2 commits intoFirebirdSQL:masterfrom
zuev-anton:config_replacement
Apr 22, 2025
Merged

Config replacement support#34
pcisar merged 2 commits intoFirebirdSQL:masterfrom
zuev-anton:config_replacement

Conversation

@zuev-anton
Copy link

@zuev-anton zuev-anton commented Apr 21, 2025

Added a new class ConfigManager.

  1. replace() replaces specified config.
  • The first argument should be the relative (to the home directory) path of the configuration file.
  • The second argument can be either the new content or the path to the file with the new content.
  • The first method call creates a backup of the configuration file.
  1. add() adds new content to the specified config.
  • The method is similar to replace() except that the new content is added to the end of the specified config.
  1. restore() restores all changed configs.
  • The argument "final" is responsible for deleting the backup file after the restore. The default value is False. The True value is only used when calling the method after the test has finished, you should not use final=True within the test.

ConfigManager objects should not be created directly, only using the store_config fixture. When the test has finished, the fixture will restore any modified configuration files.

Updated the tests/bugs/gh_8485_test.py test to demonstrate the use of a new store_config fixture.

@pcisar pcisar requested review from pavel-zotov and pcisar April 21, 2025 16:04
@pcisar
Copy link
Contributor

pcisar commented Apr 21, 2025

I think it's ok.

@pavel-zotov
Copy link
Contributor

I have no objections either

@pcisar pcisar merged commit 6a648a5 into FirebirdSQL:master Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants