Skip to content

Config replacement support #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

zuev-anton
Copy link

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 last argument 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

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