Skip to content

Commit

Permalink
Ignore deprecated pkg_resources.declare_namespace warnings (#611)
Browse files Browse the repository at this point in the history
As of setuptools v67.3.0 the use of pkg_resources.declare_namespace
in lib/mpl_toolkits/__init__.py raises a DeprecationWarning.

See also:
matplotlib/matplotlib#25244

Run tests directly rather than as a subprocess so that pytest
filterwarnings options have their intended effect.
  • Loading branch information
rjgildea authored Feb 22, 2023
1 parent 5ef3dfc commit 17a0af3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
1 change: 1 addition & 0 deletions newsfragments/611.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ignore deprecated ``pkg_resources.declare_namespace`` warnings in pytest
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ filterwarnings =
ignore:the matrix subclass is not the recommended way:PendingDeprecationWarning
ignore:numpy.dtype size changed:RuntimeWarning
ignore:Datablocks are deprecated:UserWarning
ignore:Deprecated call to `pkg_resources.declare_namespace:DeprecationWarning
junit_family = legacy
markers =
regression: dxtbx regression test
11 changes: 6 additions & 5 deletions tests/command_line/test_print_header.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
from __future__ import annotations

import procrunner
from dxtbx.command_line import print_header


def test_print_header(dials_data):
def test_print_header(dials_data, capsys):
screen = dials_data("thaumatin_eiger_screen", pathlib=True)
master = screen / "Therm_6_1_master.h5"
result = procrunner.run(["dxtbx.print_header", master])
assert not result.returncode and not result.stderr
print_header.run([str(master)])

expected_output = [
f"=== {master} ===",
"Using header reader: FormatNXmxDLS16M",
]

captured = capsys.readouterr()
assert not captured.err
for record in expected_output:
assert record.strip().encode("latin-1") in result.stdout, record
assert record.strip() in captured.out, record
12 changes: 6 additions & 6 deletions tests/command_line/test_show_mask_info.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from __future__ import annotations

import procrunner
from dxtbx.command_line import show_mask_info


def test_show_mask_info(dials_data):
def test_show_mask_info(dials_data, capsys):
data = dials_data("image_examples", pathlib=True) / "dectris_eiger_master.h5"

result = procrunner.run(["dxtbx.show_mask_info", data])
assert not result.returncode and not result.stderr

assert b"Module 0 has 637992 masked pixels of 10166590" in result.stdout
show_mask_info.run([str(data)])
captured = capsys.readouterr()
assert not captured.err
assert "Module 0 has 637992 masked pixels of 10166590" in captured.out

0 comments on commit 17a0af3

Please sign in to comment.