Skip to content

Commit 5eedb0d

Browse files
authoredOct 25, 2024
Merge pull request #112 from bobleesj/codecov
Remove two Pytest warnings due to numpy and pytest mocker in test_dump function
2 parents d5d6f17 + a3c5ea7 commit 5eedb0d

File tree

3 files changed

+30
-9
lines changed

3 files changed

+30
-9
lines changed
 

‎news/warning.rst

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* <news item>
4+
5+
**Changed:**
6+
7+
* <news item>
8+
9+
**Deprecated:**
10+
11+
* <news item>
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* Two Pytest warnings due to numpy and pytest mocker in test_dump function
20+
21+
**Security:**
22+
23+
* <news item>

‎requirements/build.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +0,0 @@
1-
python
2-
setuptools

‎tests/test_diffraction_objects.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def test_diffraction_objects_equality(inputs1, inputs2, expected):
232232

233233

234234
def test_dump(tmp_path, mocker):
235-
x, y = np.linspace(0, 10, 11), np.linspace(0, 10, 11)
235+
x, y = np.linspace(0, 5, 6), np.linspace(0, 5, 6)
236236
directory = Path(tmp_path)
237237
file = directory / "testfile"
238238
test = Diffraction_object()
@@ -242,8 +242,12 @@ def test_dump(tmp_path, mocker):
242242
test.insert_scattering_quantity(
243243
x, y, "q", metadata={"thing1": 1, "thing2": "thing2", "package_info": {"package2": "3.4.5"}}
244244
)
245-
with mocker.patch("importlib.metadata.version", return_value="3.3.0"), freeze_time("2012-01-14"):
245+
246+
mocker.patch("importlib.metadata.version", return_value="3.3.0")
247+
248+
with freeze_time("2012-01-14"):
246249
test.dump(file, "q")
250+
247251
with open(file, "r") as f:
248252
actual = f.read()
249253
expected = (
@@ -256,10 +260,6 @@ def test_dump(tmp_path, mocker):
256260
"3.000000000000000000e+00 3.000000000000000000e+00\n"
257261
"4.000000000000000000e+00 4.000000000000000000e+00\n"
258262
"5.000000000000000000e+00 5.000000000000000000e+00\n"
259-
"6.000000000000000000e+00 6.000000000000000000e+00\n"
260-
"7.000000000000000000e+00 7.000000000000000000e+00\n"
261-
"8.000000000000000000e+00 8.000000000000000000e+00\n"
262-
"9.000000000000000000e+00 9.000000000000000000e+00\n"
263-
"1.000000000000000000e+01 1.000000000000000000e+01\n"
264263
)
264+
265265
assert actual == expected

0 commit comments

Comments
 (0)
Please sign in to comment.