We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Example:
from subprocess import check_call from testfixtures import OutputCapture from ward import test @test("if correct command were called?") def _() -> None: with OutputCapture(fd = True) as stdout: check_call([ "echo", "ABC" ]) stdout.compare("ABC\n")
──────────────────────────────────────────────────────────────────────────────── Ward 0.66.0b0 | CPython 3.9.9 ───────────────────────────────────────────────────────────────────────────────── Loaded config from pyproject.toml. Found 1 test and 0 fixtures in 0.02 seconds. FAIL __test:5 if correct command were called? ─────────────────────────────────────────────────────────────────────────────── if correct command were called? ──────────────────────────────────────────────────────────────────────────────── Failed at lib/python/utils/file_system/__test.py ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ /home/mariusg/Documents/Projects/infra-terraform/lib/python/utils/file_system/__test.py:7 in _ │ │ │ │ 4 │ │ 5 @test("if correct command were called?") │ │ 6 def _() -> None: │ │ ❱ 7 │ with OutputCapture(fd = True) as stdout: │ │ 8 │ │ check_call([ │ │ 9 │ │ │ "echo", │ │ 10 │ │ │ "ABC" │ │ │ │ /home/mariusg/.pyenv/versions/3.9.9/lib/python3.9/site-packages/testfixtures/outputcapture.py:49 │ │ in __enter__ │ │ │ │ 46 │ │ │ self.output = StringIO() │ │ 47 │ │ │ self.stdout = StringIO() │ │ 48 │ │ │ self.stderr = StringIO() │ │ ❱ 49 │ │ self.enable() │ │ 50 │ │ return self │ │ 51 │ │ │ 52 │ def __exit__(self, *args): │ │ │ │ ╭────────────────────────────────── locals ──────────────────────────────────╮ │ │ │ self = <testfixtures.outputcapture.OutputCapture object at 0x7f1d39c349a0> │ │ │ ╰────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/mariusg/.pyenv/versions/3.9.9/lib/python3.9/site-packages/testfixtures/outputcapture.py:73 │ │ in enable │ │ │ │ 70 │ │ "Enable the output capture if it is disabled." │ │ 71 │ │ if self.original_stdout is None: │ │ 72 │ │ │ if self.fd: │ │ ❱ 73 │ │ │ │ self.original_stdout = os.dup(sys.stdout.fileno()) │ │ 74 │ │ │ │ self.original_stderr = os.dup(sys.stderr.fileno()) │ │ 75 │ │ │ else: │ │ 76 │ │ │ │ self.original_stdout = sys.stdout │ │ │ │ ╭────────────────────────────────── locals ──────────────────────────────────╮ │ │ │ self = <testfixtures.outputcapture.OutputCapture object at 0x7f1d39c349a0> │ │ │ ╰────────────────────────────────────────────────────────────────────────────╯ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ UnsupportedOperation: fileno ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ╭──────────── Results ────────────╮ │ 1 Test Encountered │ │ 1 Failures (100.0%) │ ╰─────────────────────────────────╯ ──────────────────────────────────────────────────────────────────────────────────── FAILED in 0.20 seconds ────────────────────────────────────────────────────────────────────────────────────
More info on simplistix/testfixtures#177
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Example:
More info on simplistix/testfixtures#177
The text was updated successfully, but these errors were encountered: