8000 Ignore certain warnings and supply pytest args as list not string by taldcroft · Pull Request #22 · sot/testr · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Ignore certain warnings and supply pytest args as list not string #22

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

Merged
merged 1 commit into from
Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10000
16 changes: 16 additions & 0 deletions testr/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@
import os


# Pytest args for main() to ignore several warnings that show up regularly in
# testing but can be ignored.
PYTEST_IGNORE_WARNINGS = (
# See https://github.com/numpy/numpy/issues/11788 for why the numpy.ufunc
# warning is apparently OK.
'-Wignore:numpy.ufunc size changed:RuntimeWarning',

# Shows up in upstream packages including ipyparallel
'-Wignore:the imp module is deprecated in favour of importlib:DeprecationWarning',

# Shows up in setuptools_scm
'-Wignore:parse functions are required to provide a named:PendingDeprecationWarning')


class TestError(Exception):
pass

Expand Down Expand Up @@ -90,6 +104,8 @@ def chdir(dirname=None):
if kwargs.pop('show_output', False) and '-s' not in args:
args = args + ('-s',)

args = args + PYTEST_IGNORE_WARNINGS

stack_level = kwargs.pop('stack_level', 1)
calling_frame_record = inspect.stack()[stack_level] # Only works for stack-based Python
calling_func_file = calling_frame_record[1]
Expand Down
8 changes: 7 additions & 1 deletion testr/setup_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ def initialize_options(self):
def run_tests(self):
# Import here because outside the eggs aren't loaded
import pytest
errno = pytest.main(self.args)
import shlex
from .runner import PYTEST_IGNORE_WARNINGS

args = list(PYTEST_IGNORE_WARNINGS)
if self.args:
args += shlex.split(self.args)
errno = pytest.main(args)
sys.exit(errno)


Expand Down
0