Skip to content

Commit

Permalink
Catch UserWarning when linting stdlib (#7833)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Nov 23, 2022
1 parent 7ebaad8 commit ed404d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/primer/test_primer_stdlib.py
Expand Up @@ -8,6 +8,7 @@
import io
import os
import sys
import warnings
from collections.abc import Iterator

import pytest
Expand Down Expand Up @@ -60,7 +61,9 @@ def test_primer_stdlib_no_crash(
# Duplicate code takes too long and is relatively safe
# We don't want to lint the test directory which are repetitive
disables = ["--disable=duplicate-code", "--ignore=test"]
Run([test_module_name] + enables + disables)
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=UserWarning)
Run([test_module_name] + enables + disables)
except SystemExit as ex:
out, err = capsys.readouterr()
assert not err, err
Expand Down

0 comments on commit ed404d3

Please sign in to comment.