Ejemplo n.º 1
0
def test_applied_context_manager(mocker, patches, cwd, is_exception):
    patch_mock = mocker.patch("octane.util.patch.patch_apply")

    class TestException(Exception):
        pass

    if is_exception:
        with pytest.raises(TestException):
            with patch.applied_patch(cwd, *patches):
                raise TestException
    else:
        with patch.applied_patch(cwd, *patches):
            pass
    assert [
        mock.call(cwd, patches),
        mock.call(cwd, patches[::-1], revert=True)
    ] == patch_mock.call_args_list
Ejemplo n.º 2
0
 def restore(self):
     with patch.applied_patch(*self.patches):
         super(NailgunArchivator, self).restore()