Skip to content

Handle warning detection in tests with pytest #36

Description

@thomas-saigre

Example in test_colors.py :

def test_color(color, warning_match, request):
    id = request.node.callspec.id
    if warning_match is None:
        assert_equality(plot_color(color), os.path.join(this_dir, test_name, f"{test_name}_{id}_reference.tex"))
    else:
        with pytest.warns(UserWarning, match=warning_match):
            assert_equality(plot_color(color), os.path.join(this_dir, test_name, f"{test_name}_{id}_reference.tex"))

Final goal is to have everything in green when pytest is run (for now we have some yellow !)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions