Skip to content

Commit 3bc2ac2

Browse files
change mocking to pytest mocker
1 parent 82078ab commit 3bc2ac2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

requirements/requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ nbstripout
99
pre-commit
1010
pre-commit-hooks
1111
pytest
12+
pytest-mock
1213
sphinx
1314
twine
1415
# These are dependencies of various sphinx extensions for documentation.

src/diffpy/labpdfproc/tests/test_functions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ def test_set_muls_at_angle(inputs, expected):
5656
assert actual_muls_sorted == pytest.approx(expected_muls_sorted, rel=1e-4, abs=1e-6)
5757

5858

59-
def test_compute_cve(monkeypatch):
60-
monkeypatch.setattr("diffpy.labpdfproc.functions.N_POINTS_ON_DIAMETER", int(4))
61-
monkeypatch.setattr("diffpy.labpdfproc.functions.TTH_GRID", np.array([45, 60, 90]))
59+
def test_compute_cve(mocker):
60+
mocker.patch("diffpy.labpdfproc.functions.N_POINTS_ON_DIAMETER", 4)
61+
mocker.patch("diffpy.labpdfproc.functions.TTH_GRID", np.array([45, 60, 90]))
6262
input_pattern = Diffraction_object(wavelength=1.54)
6363
input_pattern.insert_scattering_quantity(
6464
np.array([45, 60, 90]),

0 commit comments

Comments
 (0)