ROS-TCP-Endpoint
ROS-TCP-Endpoint copied to clipboard
fixed mock.called_once bugs
Proposed change(s)
In the test code several 'assert_called_once' have been replaced by 'assert_called_once()'. Doing so revealed another bug. Following change was necessary
mock_sys_modules.assert_called_once() # bug: sys.modules["foo"] does not call the mock
mock_sys_modules.__getitem__.assert_called_once() # correct: it calls the mocks's __getitem__ instead
Useful links (GitHub issues, JIRA tickets, forum threads, etc.)
This fixes #121
Types of change(s)
- [X] Bug fix
- [ ] New feature
- [ ] Code refactor
- [ ] Documentation update
- [ ] Other (please describe)
Testing and Verification
The unit tests have been executed like:
ROS-TCP-Endpoint/test>python -m pytest test*.py
All 38 tests passed.
Please describe the tests that you ran to verify your changes. Please also provide instructions, ROS packages, and Unity project files as appropriate so we can reproduce the test environment.
Test Configuration:
- ROS Ubuntu 20.04, ROS Noetic
Checklist
- [X] Ensured this PR is up-to-date with the
devbranch - [X] Created this PR to target the
devbranch - [X] Followed the style guidelines as described in the Contribution Guidelines
- [ ] Added tests that prove my fix is effective or that my feature works
- [ ] Updated the Changelog and described changes in the Unreleased section
- [ ] Updated the documentation as appropriate