Reputation: 135
Pytest is new to me. We try to verify that we have all expected files in a project.
I like every part of the pytest output except for the detailed FAILURES that will confuse our non-programmers.
How can we suppress the FAILURES output?
Current code:
import os.path
import pytest
spec = {"expected_files": ["Dockerfile", "Duckerfile", "Daskerfile"]}
@pytest.mark.parametrize("expected_file", spec['expected_files'])
def test_expected_file_is_in_project(expected_file):
assert os.path.isfile(expected_file), "File \""+expected_file+"\" not found in project"
Output after running the "pytest -v" command
Upvotes: 3
Views: 862
Reputation: 4471
You may run pytest
with the traceback (tb
) option set to no
in order to suppress the traceback reporting, i.e.:
pytest --tb=no
Check out the Modifying Python traceback printing section of the pytest
documentation.
Upvotes: 7