diff options
Diffstat (limited to '.github/instructions')
| -rw-r--r-- | .github/instructions/modules.instructions.md | 2 | ||||
| -rw-r--r-- | .github/instructions/tests.instructions.md | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/.github/instructions/modules.instructions.md b/.github/instructions/modules.instructions.md index 85a34015..d7782e1e 100644 --- a/.github/instructions/modules.instructions.md +++ b/.github/instructions/modules.instructions.md @@ -34,4 +34,4 @@ Verify any changed redirect target exists as a real module file under `plugins/m ## cliconf / terminal plugins `plugins/cliconf/vyos.py` — do not modify without understanding edit-mode and commit semantics. -`plugins/terminal/vyos.py` — handles prompt detection; regex changes require testing against all supported VyOS versions (1.3.8, 1.4.1, 1.4.2, 1.5 rolling). +`plugins/terminal/vyos.py` — handles prompt detection; regex changes require testing against all supported VyOS versions listed in README.md. diff --git a/.github/instructions/tests.instructions.md b/.github/instructions/tests.instructions.md index 66f08f88..150db41e 100644 --- a/.github/instructions/tests.instructions.md +++ b/.github/instructions/tests.instructions.md @@ -20,15 +20,23 @@ class TestVyosFooModule(TestVyosModule): ## Mocking: resource modules -Resource module tests require two framework-level patches in `setUp`: +Resource module tests require two framework-level patches in `setUp` with corresponding cleanup in `tearDown`: ```python +# in setUp: self.mock_get_resource_connection_config = patch( "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection" ) +self.get_resource_connection_config = self.mock_get_resource_connection_config.start() + self.mock_get_resource_connection_facts = patch( "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection" ) +self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() + +# in tearDown: +self.mock_get_resource_connection_config.stop() +self.mock_get_resource_connection_facts.stop() ``` Most resource module tests also patch the facts class's `get_device_data` method directly and use it in `load_fixtures`: |
