Skip to content

Commit

Permalink
add monkeypatch support
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasohara committed Jan 14, 2024
1 parent 3b718c9 commit 6af3989
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions mezcla/unittest_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,16 @@ def do_assert(self, condition, message=None):
## """Wrapper around do_assert (q.v.)"""
## self.do_assert(*args, **kwargs)

@pytest.fixture(autouse=True)
def monkeypatch(self, monkeypatch):
"""Support for using pytest monkeypatch"""
# See https://docs.pytest.org/en/latest/how-to/monkeypatch.html
self.monkeypatch = monkeypatch

@pytest.fixture(autouse=True)
def capsys(self, capsys):
"""Support for capture stdout and stderr"""
"""Support for capturing stdout and stderr"""
# See https://docs.pytest.org/en/latest/how-to/capture-stdout-stderr.html
self.capsys = capsys

def get_stdout_stderr(self):
Expand All @@ -413,7 +420,7 @@ def get_stderr(self):
"""Get currently captured standard error (see get_stdout_stderr)"""
_stdout, stderr = self.get_stdout_stderr()
return stderr

def tearDown(self):
"""Per-test cleanup: deletes temp file unless detailed debugging"""
debug.trace(6, "TestWrapper.tearDown()")
Expand Down

0 comments on commit 6af3989

Please sign in to comment.