Skip to content
New issue

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

Pytest stdout capturing #397

Merged
merged 2 commits into from
Apr 8, 2020
Merged

Pytest stdout capturing #397

merged 2 commits into from
Apr 8, 2020

Conversation

iamdefinitelyahuman
Copy link
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