Skip to content

Commit

Permalink
Fix test due to caplog incompatibility (canonical#1461)
Browse files Browse the repository at this point in the history
caplog.text is giving different results on focal. Use caplog.records
instead on failing test.
  • Loading branch information
aciba90 authored May 18, 2022
1 parent 9624758 commit d7fae2b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/unittests/cmd/devel/test_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,11 @@ def test_handle_args_renders_instance_data_vars_in_template(
with mock.patch("sys.stderr", new_callable=StringIO):
with mock.patch("sys.stdout", new_callable=StringIO) as m_stdout:
assert render.handle_args("anyname", args) == 0
assert "Converted jinja variables\n{" in caplog.text
# TODO enable after pytest>=3.4
# more info: https://docs.pytest.org/en/stable/how-to/logging.html
# assert "Converted jinja variables\n{" in m_stderr.getvalue()
# Make sure the log is correctly captured. There is an issue
# with this fixture in pytest==4.6.9 (focal):
assert (
"Converted jinja variables\n{" in caplog.records[-1].getMessage()
)
assert "rendering: jinja worked" == m_stdout.getvalue()

@skipUnlessJinja()
Expand Down

0 comments on commit d7fae2b

Please sign in to comment.