Skip to content

Pytest stdout capturing#397

Merged
iamdefinitelyahuman merged 2 commits intomasterfrom
pytest-output
Apr 8, 2020
Merged

Pytest stdout capturing#397
iamdefinitelyahuman merged 2 commits intomasterfrom
pytest-output

Conversation

@iamdefinitelyahuman
Copy link
Copy Markdown
Member

What I did

  1. Allow -s flag in brownie test
  2. Add PytestPrinter class to improve readability of output when stdout capture is disabled.

Closes #389

How I did it

  1. When stdout capture is disabled, verbose output is automatically enabled.
  2. PytestPrinter replaces the builtin print method during test execution to:
    a. add a newline before the first line
    b. add a second test id prior to reporting the test result

The final output ends up looking something like this:

tests/test_transfer.py::test_transfer RUNNING
this is some text from a call to print
tests/test_transfer.py::test_transfer PASSED

How to verify it

Run tests.

When capture is disabled via -s, automatically enable verbose output
and replace builtin print with custom PytestPrinter.
@iamdefinitelyahuman iamdefinitelyahuman merged commit 981427e into master Apr 8, 2020
@iamdefinitelyahuman iamdefinitelyahuman deleted the pytest-output branch April 8, 2020 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add -s flag in brownie test

1 participant