Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove xpass cases and turn xpass into failures #7267

Merged
merged 4 commits into from
Mar 9, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions astropy/coordinates/tests/test_sky_coord_velocities.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_useful_error_missing():

# ----------------------Operations on SkyCoords w/ velocities-------------------

# define some fixtires to get baseline coordinates to try operations with
# define some fixtures to get baseline coordinates to try operations with
@pytest.fixture(scope="module", params=[(False, False),
(True, False),
(False, True),
Expand Down Expand Up @@ -177,12 +177,14 @@ def test_transforms(sc):
assert isinstance(trans.frame, Galactic)


@pytest.mark.xfail
def test_transforms_diff(sc):
# note that arguably this *should* fail for the no-distance cases: 3D
# information is necessary to truly solve this, hence the xfail
trans = sc.transform_to(PrecessedGeocentric(equinox='B1975'))
assert isinstance(trans.frame, PrecessedGeocentric)
if sc.distance == 1:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we ever want to test multi-D arrays, this would fail. How about

if not sc.distance.unit.is_equivalent(u.m):

pytest.xfail('Should fail for no-distance cases')
else:
trans = sc.transform_to(PrecessedGeocentric(equinox='B1975'))
assert isinstance(trans.frame, PrecessedGeocentric)


@pytest.mark.skipif(str('not HAS_SCIPY'))
Expand Down
6 changes: 4 additions & 2 deletions astropy/stats/tests/test_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ def test_mad_std():
assert_allclose(funcs.mad_std(data), 2.0, rtol=0.05)


@pytest.mark.xfail()
def test_mad_std_scalar_return():
with NumpyRNGContext(12345):
data = normal(5, 2, size=(10, 10))
Expand All @@ -337,7 +336,10 @@ def test_mad_std_scalar_return():
with catch_warnings():
rslt = funcs.mad_std(data)
assert np.isscalar(rslt)
assert not np.isnan(rslt)
try:
assert not np.isnan(rslt)
except AssertionError:
pytest.xfail('See #5232')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That PR discussion is really long; maybe add a link to a specific comment that summarizes the expected fail? I don't remember if this particular test is expected to fail only on certain numpy versions or what...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't involved in that discussion and can't follow it completely (it is very long). Is #5232 (comment) close enough? It does seem weird that this test would only xpass in Numpy 1.11 and nothing else.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...it would probably take me half an hour to figure it out reading back through that. Oh well, let's just leave the comment here - at least it is theoretically possible to reconstruct my mental state at the time...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay then. 😉

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that comment is right, this problem will auto-disappear in 3.1, since we'll only support numpy >=1.13

That also suggests, though, this should really be a test on numpy version. I don't really want to hold up this supposedly simple PR, but could you add a comment that might well be resolved in later numpy? Please include something like NUMPY_LT_1_13?? in the comment, so that we'll find it!



def test_mad_std_warns():
Expand Down
4 changes: 2 additions & 2 deletions astropy/units/tests/test_quantity_ufuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,6 @@ def test_two_argument_ufunc_at(self):
np.greater.at(s, i, 1.*u.km)


@pytest.mark.xfail("NUMPY_LT_1_13")
class TestUfuncReduceReduceatAccumulate:
"""Test 'reduce', 'reduceat' and 'accumulate' methods for ufuncs

Expand All @@ -955,6 +954,7 @@ def test_one_argument_ufunc_reduce_accumulate(self):
with pytest.raises(ValueError):
np.sin.reduceat(s, i)

@pytest.mark.xfail("NUMPY_LT_1_13")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that's a nice one - the other test method already gives the right failures!

def test_two_argument_ufunc_reduce_accumulate(self):
s = np.arange(10.) * u.m
i = np.array([0, 5, 1, 6])
Expand Down Expand Up @@ -1012,7 +1012,6 @@ def test_two_argument_ufunc_reduce_accumulate(self):
assert s_multiply_reduceat.unit is u.dimensionless_unscaled


@pytest.mark.xfail("NUMPY_LT_1_13")
class TestUfuncOuter:
"""Test 'outer' methods for ufuncs

Expand All @@ -1026,6 +1025,7 @@ def test_one_argument_ufunc_outer(self):
with pytest.raises(ValueError):
np.sin.outer(s)

@pytest.mark.xfail("NUMPY_LT_1_13")
def test_two_argument_ufunc_outer(self):
s1 = np.arange(10.) * u.m
s2 = np.arange(2.) * u.s
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ open_files_ignore = "astropy.log" "/etc/hosts"
remote_data_strict = true
addopts = -p no:warnings
asdf_schema_root = astropy/io/misc/asdf/schemas
xfail_strict = true

[bdist_wininst]
bitmap = static/wininst_background.bmp
Expand Down