-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
TST: Add test decorators for redirecting stdout and stderr #15952
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
Conversation
c256e1d to
9edafd9
Compare
Codecov Report
@@ Coverage Diff @@
## master #15952 +/- ##
==========================================
+ Coverage 90.99% 91% +0.01%
==========================================
Files 145 145
Lines 49570 49576 +6
==========================================
+ Hits 45106 45118 +12
+ Misses 4464 4458 -6
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #15952 +/- ##
==========================================
+ Coverage 90.99% 91% +0.01%
==========================================
Files 145 145
Lines 49570 49576 +6
==========================================
+ Hits 45106 45118 +12
+ Misses 4464 4458 -6
Continue to review full report at Codecov.
|
pandas/tests/io/parser/common.py
Outdated
|
|
||
| # Engines are verbose in different ways. | ||
| if self.engine == 'c': | ||
| self.assertIn('Tokenization took:', output) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while you are at it, can you use pytest idioms here, e.g. self.assertIn -> assert output in ......
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing. Done.
pandas/tests/io/parser/common.py
Outdated
| self.assertIn('Parser memory cleanup took:', output) | ||
| else: # Python engine | ||
| exp = 'Filled 1 NA values in column a\n' | ||
| self.assertEqual(output, exp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert output == exp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, done.
| con=self.conn) | ||
| finally: | ||
| sys.stdout = sys.__stdout__ | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use pytest.raises
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, done.
pandas/util/testing.py
Outdated
| """ | ||
| Capture stdout in a buffer so that it can be checked | ||
| (or suppressed) during testing. | ||
| """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you say this is a decorator, and show how to use it. (same as on capture_stderr).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also move these near the other routine which maniuplates stdout (about encoding IIRC).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, done.
f060903 to
c4b934f
Compare
c4b934f to
82e11c1
Compare
|
thanks @gfyoung ! |
Add testing decorators for redirecting
stdoutandstderr.xref #15925 (comment)