Monkeypath.setattr shortcut. Example: .. code-block:: python >>> def test_foo(patching): >>> # execv value here will be mock.MagicMock by default. >>> execv = patching('os.execv') >>> patching('sys.platform', 'darwin') # set concrete value
(monkeypatch, request)
| 613 | |
| 614 | @pytest.fixture() |
| 615 | def patching(monkeypatch, request): |
| 616 | """Monkeypath.setattr shortcut. |
| 617 | Example: |
| 618 | .. code-block:: python |
| 619 | >>> def test_foo(patching): |
| 620 | >>> # execv value here will be mock.MagicMock by default. |
| 621 | >>> execv = patching('os.execv') |
| 622 | >>> patching('sys.platform', 'darwin') # set concrete value |
| 623 | >>> patching.setenv('DJANGO_SETTINGS_MODULE', 'x.settings') |
| 624 | >>> # val will be of type mock.MagicMock by default |
| 625 | >>> val = patching.setitem('path.to.dict', 'KEY') |
| 626 | """ |
| 627 | return _patching(monkeypatch, request) |
| 628 | |
| 629 | |
| 630 | @contextmanager |
no test coverage detected