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

Test for mock patch multiple #156

Merged
merged 2 commits into from Mar 2, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.txt
Expand Up @@ -8,6 +8,8 @@
(https://github.com/wolever/parameterized/pull/148; thanks @KOLANICH)
* Add support for ``IsolatedAsyncioTestCase``
(https://github.com/wolever/parameterized/pull/135; thanks @Ronserruya)
* Work around for bug bpo-40126 in older versions of ``mock``
(https://github.com/wolever/parameterized/pull/129; thanks @alexpizarroj)

0.8.1 (2021-01-09)
* Add README and LICENSE to pypi sdist package
Expand Down
30 changes: 30 additions & 0 deletions parameterized/test.py
Expand Up @@ -285,6 +285,36 @@ def test_mock_patch_standalone_function(foo, mock_umask):
)


class TestParameterizedExpandWithMockPatchMultiple(TestCase):
expect([
"test_mock_patch_multiple_expand(42, 'umask', 'getpid')",
])

@parameterized.expand([(42, )])
@mock.patch.multiple("os", umask=mock.DEFAULT, getpid=mock.DEFAULT)
def test_mock_patch_multiple_expand(self, param, umask, getpid):
missing_tests.remove(
"test_mock_patch_multiple_expand(%r, %r, %r)" %(
param, umask._mock_name, getpid._mock_name
)
)


expect("standalone", [
"test_mock_patch_multiple_standalone(42, 'umask', 'getpid')",
])

@parameterized([(42, )])
@mock.patch.multiple("os", umask=mock.DEFAULT, getpid=mock.DEFAULT)
def test_mock_patch_multiple_standalone(param, umask, getpid):
missing_tests.remove(
"test_mock_patch_multiple_standalone(%r, %r, %r)" %(
param, umask._mock_name, getpid._mock_name
)
)



class TestParamerizedOnTestCase(TestCase):
expect([
"test_on_TestCase('foo0', bar=None)",
Expand Down