-
Notifications
You must be signed in to change notification settings - Fork 50
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
Print version on debug verbosity level #765
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
"""Perform a functional test of the debug verbosity level.""" | ||
import logging | ||
|
||
import pytest | ||
|
||
import orion.core.cli | ||
|
||
|
||
def test_version_print_debug_verbosity(caplog): | ||
"""Tests that Orion version is printed in debug verbosity level""" | ||
|
||
caplog.set_level(logging.INFO) | ||
with pytest.raises(SystemExit): | ||
orion.core.cli.main(["-vv"]) | ||
assert "Orion version : " not in caplog.text | ||
|
||
caplog.clear() | ||
caplog.set_level(logging.DEBUG) | ||
with pytest.raises(SystemExit): | ||
orion.core.cli.main([""]) | ||
assert "Orion version : " not in caplog.text | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a good idea to test that the log was effective at the DEBUG level only. Instead of testing with INFO and then with DEBUG you could use
https://docs.pytest.org/en/6.2.x/logging.html#caplog-fixture |
||
|
||
caplog.clear() | ||
caplog.set_level(logging.DEBUG) | ||
with pytest.raises(SystemExit): | ||
orion.core.cli.main(["-vv"]) | ||
assert "Orion version : " in caplog.text |
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.
You have an error here: https://github.com/Epistimio/orion/runs/4939592554?check_suite_focus=true#step:5:15
This is because pylint prefers a format with strings using '%s' instead of concatenating them. So it should rather be
Sorry I didn't catch this in the first place. 😅