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)
| 634 | |
| 635 | @pytest.fixture() |
| 636 | def patching(monkeypatch, request): |
| 637 | """Monkeypath.setattr shortcut. |
| 638 | Example: |
| 639 | .. code-block:: python |
| 640 | >>> def test_foo(patching): |
| 641 | >>> # execv value here will be mock.MagicMock by default. |
| 642 | >>> execv = patching('os.execv') |
| 643 | >>> patching('sys.platform', 'darwin') # set concrete value |
| 644 | >>> patching.setenv('DJANGO_SETTINGS_MODULE', 'x.settings') |
| 645 | >>> # val will be of type mock.MagicMock by default |
| 646 | >>> val = patching.setitem('path.to.dict', 'KEY') |
| 647 | """ |
| 648 | return _patching(monkeypatch, request) |
| 649 | |
| 650 | |
| 651 | @contextmanager |
no test coverage detected