Skip to content

Commit ddb21f4

Browse files
committed
Ignore known warnings triggered by tests
1 parent 8fdaca8 commit ddb21f4

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,6 @@ dev = [
5050
[tool.pytest.ini_options]
5151
addopts = "--cov astroforge --cov-report term-missing --verbose"
5252
testpaths = ["tests"]
53-
53+
markers = [
54+
"download: marks tests as requiring an internet connection for downloading a file",
55+
]

src/astroforge/coordinates/_transformations.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"eccentric_anomaly_from_true_anomaly",
5050
"eccentric_anomaly_from_mean_anomaly",
5151
"ConvergenceException",
52+
"PrecisionWarning",
5253
]
5354

5455

tests/test_transforms.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
eccentric_anomaly_from_true_anomaly,
4141
mean_anomaly_from_true_anomaly,
4242
ConvergenceException,
43+
PrecisionWarning,
4344
)
4445

4546
# disable numba's jit
@@ -309,7 +310,8 @@ def test_cartesian_keplerian_zero():
309310
"true_anomaly_rad": 1.126627,
310311
}
311312

312-
keplerian_elements = cartesian_to_keplerian(pos, vel)
313+
with pytest.warns(PrecisionWarning):
314+
keplerian_elements = cartesian_to_keplerian(pos, vel)
313315

314316
for key, true_val in truth.items():
315317
measured_val = keplerian_elements[key]
@@ -364,13 +366,16 @@ def test_ea_from_ma_divergence():
364366

365367

366368
class TestKeplerianEdgeCases:
369+
370+
@pytest.mark.filterwarnings("ignore:.*")
367371
def test_zero_raan(self):
368372
pos = np.array([1, 0, 0])
369373
vel = np.array([1, 0, 0])
370374
kep = cartesian_to_keplerian(pos, vel)
371375

372376
assert kep["raan_rad"] < 1e-6
373377

378+
@pytest.mark.filterwarnings("ignore:.*")
374379
def test_wrapped_raan(self):
375380
pos = np.array([0, -1, 0])
376381
vel = np.array([0, 0, 1])
@@ -379,6 +384,7 @@ def test_wrapped_raan(self):
379384
assert kep["raan_rad"] >= 0
380385
assert kep["raan_rad"] <= 2 * np.pi
381386

387+
@pytest.mark.filterwarnings("ignore:.*")
382388
def test_true_anom_sign(self):
383389
pos = np.array([1, 0, 0])
384390
vel = np.array([-1, 0, 0])
@@ -387,6 +393,7 @@ def test_true_anom_sign(self):
387393
assert kep["true_anomaly_rad"] >= 0
388394
assert kep["true_anomaly_rad"] <= 2 * np.pi
389395

396+
@pytest.mark.filterwarnings("ignore:.*")
390397
def test_dot_overcalc(self):
391398
"""Make sure everything works properly even if dot products
392399
overshoot calculations due to floating point issues."""

0 commit comments

Comments
 (0)