-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
sub-steps progress report #3235
Comments
linking - #153 for documentative purposes |
This can be implemented a simple fixture: import pytest
@pytest.fixture
def print_sub_report(pytestconfig):
dummy = lambda *args: None
#print('option', pytestconfig.getoption('verbose'))
if pytestconfig.getoption('verbose') <= 0:
return dummy
terminal_reporter = pytestconfig.pluginmanager.getplugin('terminalreporter')
if terminal_reporter is None:
return dummy
first_call = [True]
def print_sub_report(msg):
if first_call[0]:
terminal_reporter.write('\n')
first_call[0] = False
terminal_reporter.write(' ' + msg + '\n')
return print_sub_report
def test_something(print_sub_report):
print_sub_report('create db')
print_sub_report('populate tables')
print_sub_report('simulate_parallel_add') Output:
While adding this to the core is simple, not sure if a separate plugin would be better at least as a first interaction, to nail down the API and see which other integrations would be necessary ( |
This is very similar to #1602, although the intents are different (informational vs debugging). |
@nicoddemus I like what you propose. Do you want to release it as a plugin, and let';s see where it goes, or should I? |
@gaborbernat feel free to go for it if you have the time! 👍 |
@nicoddemus it's not finished and posted yet to PyPi, but can you have a first look at it https://github.com/gaborbernat/pytest-print Will publish next week but would be nice an eye on it before. The timestamps thing mirrors how https://docs.python.org/3/library/logging.html#logrecord-attributes relativeCreated works. Thanks! PS. Should we move it under pytest-dev? |
Looks nice to me. I'm fine with moving under |
@nicoddemus https://pypi.org/project/pytest-print/, done :-D there is a test failing on windows, seems the pytest flag is not picked up for some reason, will check |
@nicoddemus want to invite the project under pytest then? 😃 |
Sure! Transfer the project to me and I will complete the transfer. |
|
Done. 😁 |
@gaborbernat could you also add me as maintainer on PyPI? Thanks! |
Done 👍 |
Thanks! |
Would it be possible to add sub-steps reporting to test? :-) e.g. imagine I have some integration test cases that run reasonably long (e.g. 2 minutes, I would like to give some progress report to the user, to not let him wander around what's happening). E.g. with -vvvv to say:
Do you guys think that's a good idea?
The text was updated successfully, but these errors were encountered: