Skip to content

Commit

Permalink
Merge pull request poliastro#1333 from Syed-Osama-Hussain/mark-tests-…
Browse files Browse the repository at this point in the history
…xfail-for-32-bit-systems

Mark test xfail for 32 bit systems.
  • Loading branch information
astrojuanlu authored Nov 8, 2021
2 parents 01a12df + 610835c commit e022f9d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/tests_plotting/test_core.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import sys

import pytest
from astropy import time, units as u

Expand Down Expand Up @@ -44,6 +46,7 @@ def test_set_different_attractor_raises_error(plotter_class):
assert "Attractor has already been set to Earth" in excinfo.exconly()


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
@pytest.mark.parametrize("plotter_class", [OrbitPlotter2D, OrbitPlotter3D])
def test_plot_sets_attractor(plotter_class):
frame = plotter_class()
Expand All @@ -53,6 +56,7 @@ def test_plot_sets_attractor(plotter_class):
assert frame._attractor == iss.attractor


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
@pytest.mark.parametrize("plotter_class", [OrbitPlotter2D, OrbitPlotter3D])
def test_plot_appends_data(plotter_class):
frame = plotter_class()
Expand Down Expand Up @@ -101,6 +105,7 @@ def test_ephem_without_frame_raises_error():
)


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
def test_plot_3d_trajectory_plots_a_trajectory():
frame = OrbitPlotter3D()
assert len(frame.trajectories) == 0
Expand All @@ -113,6 +118,7 @@ def test_plot_3d_trajectory_plots_a_trajectory():
assert frame._attractor == Sun


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
def test_plot_2d_trajectory_plots_a_trajectory():
frame = OrbitPlotter2D()
assert len(frame.trajectories) == 0
Expand Down
13 changes: 13 additions & 0 deletions tests/tests_plotting/test_static.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import sys

import pytest
from astropy import units as u
from astropy.coordinates import CartesianDifferential, CartesianRepresentation
Expand All @@ -15,6 +17,7 @@
from poliastro.util import time_range


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
def test_axes_labels_and_title():
ax = plt.gca()
op = StaticOrbitPlotter(ax)
Expand All @@ -25,6 +28,7 @@ def test_axes_labels_and_title():
assert ax.get_ylabel() == "$y$ (km)"


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
def test_number_of_lines_for_osculating_orbit():
op1 = StaticOrbitPlotter()
ss = iss
Expand All @@ -34,6 +38,7 @@ def test_number_of_lines_for_osculating_orbit():
assert len(l1) == 2


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
def test_legend():
op = StaticOrbitPlotter()
ss = iss
Expand All @@ -46,6 +51,7 @@ def test_legend():
assert legend.get_texts()[0].get_text() == label


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
def test_color():
op = StaticOrbitPlotter()
ss = iss
Expand All @@ -58,6 +64,7 @@ def test_color():
assert element.get_c() == c


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
def test_plot_trajectory_sets_label():
expected_label = "67P"

Expand Down Expand Up @@ -96,6 +103,7 @@ def test_set_frame_plots_same_colors():
assert colors1 == colors2


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
def test_redraw_keeps_trajectories():
# See https://github.com/poliastro/poliastro/issues/518
op = StaticOrbitPlotter()
Expand Down Expand Up @@ -130,6 +138,7 @@ def test_plot_ephem_different_plane_raises_error():
)


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
@pytest.mark.mpl_image_compare
def test_basic_plotting():
fig, ax = plt.subplots()
Expand All @@ -139,6 +148,7 @@ def test_basic_plotting():
return fig


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
@pytest.mark.mpl_image_compare
def test_basic_trajectory_plotting():
fig, ax = plt.subplots()
Expand All @@ -150,6 +160,7 @@ def test_basic_trajectory_plotting():
return fig


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
@pytest.mark.mpl_image_compare
def test_basic_orbit_and_trajectory_plotting():
fig, ax = plt.subplots()
Expand All @@ -160,6 +171,7 @@ def test_basic_orbit_and_trajectory_plotting():
return fig


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
@pytest.mark.mpl_image_compare
def test_trail_plotting():
fig, ax = plt.subplots()
Expand All @@ -169,6 +181,7 @@ def test_trail_plotting():
return fig


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
@pytest.mark.mpl_image_compare
def test_plot_different_planes():
fig, ax = plt.subplots()
Expand Down
11 changes: 11 additions & 0 deletions tests/tests_twobody/test_orbit.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pickle
import sys
from collections import OrderedDict
from functools import partial
from unittest import mock
Expand Down Expand Up @@ -386,6 +387,7 @@ def test_orbit_no_frame_representation():
assert str(ss) == repr(ss) == expected_str


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
def test_sample_numpoints():
_d = 1.0 * u.AU # Unused distance
_ = 0.5 * u.one # Unused dimensionless value
Expand All @@ -398,6 +400,7 @@ def test_sample_numpoints():
assert len(positions) == 50


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
@pytest.mark.parametrize("num_points", [3, 5, 7, 9, 11, 101])
def test_sample_num_points(num_points):
# Data from Vallado, example 2.4
Expand All @@ -414,6 +417,7 @@ def test_sample_num_points(num_points):
# assert_quantity_allclose(rr[num_points // 2].data.xyz, expected_ss.r)


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
def test_sample_big_orbits():
# See https://github.com/poliastro/poliastro/issues/265
ss = Orbit.from_vectors(
Expand All @@ -425,13 +429,15 @@ def test_sample_big_orbits():
assert len(positions) == 15


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
def test_hyperbolic_nu_value_check(hyperbolic):
positions = hyperbolic.sample(100)

assert isinstance(positions, CartesianRepresentation)
assert len(positions) == 100


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
def test_hyperbolic_modulus_wrapped_nu():
ss = Orbit.from_vectors(
Sun,
Expand All @@ -445,6 +451,7 @@ def test_hyperbolic_modulus_wrapped_nu():
assert_quantity_allclose(positions[0].xyz, ss.r)


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
@pytest.mark.parametrize("min_anomaly", [-30 * u.deg, -10 * u.deg])
@pytest.mark.parametrize("max_anomaly", [10 * u.deg, 30 * u.deg])
def test_sample_hyperbolic_limits(hyperbolic, min_anomaly, max_anomaly):
Expand All @@ -457,6 +464,7 @@ def test_sample_hyperbolic_limits(hyperbolic, min_anomaly, max_anomaly):
assert len(coords) == num_points


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
def test_sample_hyperbolic_outside_limits(hyperbolic):
with pytest.warns(OrbitSamplingWarning, match="anomaly outside range, clipping"):
hyperbolic.sample(3, min_anomaly=-np.pi * u.rad)
Expand All @@ -474,6 +482,7 @@ def test_orbit_is_pickable(hyperbolic):
assert ss_result.epoch == hyperbolic.epoch


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
def test_orbit_plot_is_static():
# Data from Curtis, example 4.3
r = [-6_045, -3_490, 2_500] * u.km
Expand All @@ -498,6 +507,7 @@ def test_orbit_plot_static_3d():
ss.plot(use_3d=True)


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
@pytest.mark.parametrize("use_3d", [False, True])
def test_orbit_plot_is_not_static(use_3d):
from plotly.graph_objects import Figure
Expand Down Expand Up @@ -1069,6 +1079,7 @@ def test_propagate_to_anomaly_gives_expected_result():
)


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
def test_sample_with_out_of_range_anomaly_works():
# From "Going to Jupiter with Python using Jupyter and poliastro.ipynb"
ic1 = Orbit.from_vectors(
Expand Down
3 changes: 3 additions & 0 deletions tests/tests_twobody/test_propagation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import sys

import numpy as np
import pytest
from astropy import time, units as u
Expand Down Expand Up @@ -425,6 +427,7 @@ def test_propagation_sets_proper_epoch():
assert propagated.epoch == expected_epoch


@pytest.mark.xfail(sys.maxsize < 2 ** 32, reason="not supported for 32 bit systems")
def test_sample_custom_body_raises_warning_and_returns_coords():
# See https://github.com/poliastro/poliastro/issues/649
orbit = Orbit.circular(Moon, 100 * u.km)
Expand Down

0 comments on commit e022f9d

Please sign in to comment.