Skip to content
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

tests: Adds mock patch autospec fixture #90

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion coriolisclient/tests/cli/test_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ class GetCoriolisDiagnosticsTestCase(test_base.CoriolisBaseTestCase):
def setUp(self, mock__init__):
mock__init__.return_value = None
super(GetCoriolisDiagnosticsTestCase, self).setUp()
self.diag = diagnostics.GetCoriolisDiagnostics()
self.diag = diagnostics.GetCoriolisDiagnostics(
mock.sentinel.app, mock.sentinel.app_args)

@mock.patch.object(lister.Lister, 'get_parser')
def test_get_parser(self, mock_get_parser):
Expand Down
7 changes: 7 additions & 0 deletions coriolisclient/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
"""Defines base class for all tests."""

from oslotest import base
from oslotest import mock_fixture

# NOTE(claudiub): this needs to be called before any mock.patch calls are
# being done, and especially before any other test classes load. This fixes
# the mock.patch autospec issue:
# https://github.com/testing-cabal/mock/issues/396
mock_fixture.patch_mock_module()


class CoriolisBaseTestCase(base.BaseTestCase):
Expand Down
Loading