Skip to content

TST: Fixed xfail for tests in pandas/tests/tseries/offsets/test_offsets_properties.py #32465

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

Closed
wants to merge 29 commits into from

Conversation

ShaharNaveh
Copy link
Member

@@ -85,8 +85,6 @@
# Offset-specific behaviour tests


# Based on CI runs: Always passes on OSX, fails on Linux, sometimes on Windows
@pytest.mark.xfail(strict=False, reason="inconsistent between OSs, Pythons")
Copy link
Member Author

@ShaharNaveh ShaharNaveh Mar 5, 2020

Choose a reason for hiding this comment

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

It says here that on linux it always fails (at least this is how I understood it), but it passed on my machine (I run linux).

Copy link
Member Author

@ShaharNaveh ShaharNaveh Mar 5, 2020

Choose a reason for hiding this comment

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

Ok so I think I understood why this failing:

hypothesis.extra.dateutil.timezones is using dateutil.UTC which is avaible only from dateutils>=2.7.0 (https://dateutil.readthedocs.io/en/stable/tz.html#dateutil.tz.dateutil.tz.UTC)

but macOS have a pinned python-dateutils to 2.6.1 which then leads to errors.


@jbrockmendel is bumping python-dateutils to 2.7.0 is an option/reasonable thing to do?

if not I will put a pytest.mark.skipif decorator (seems more likely to be the answer)

Copy link
Member

Choose a reason for hiding this comment

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

is bumping python-dateutils to 2.7.0 is an option/reasonable thing to do?

2.7.0 is 2 days shy of 2 years old, so I think we're OK bumping

Copy link
Member

Choose a reason for hiding this comment

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

@MomIsBestFriend this is definitely an improvement, but we can also just bump the dateutil requirement

Copy link
Member Author

Choose a reason for hiding this comment

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

@MomIsBestFriend this is definitely an improvement, but we can also just bump the dateutil requirement

Sure! will do that in a separate PR

assert res[0] == rng[0] + offset
assert res[-1] == rng[-1] + offset
res2 = ser + offset
# apply_index is only for indexes, not series, so no res2_v2

# TODO: Check randomly assorted entries, not just first/last
Copy link
Member Author

@ShaharNaveh ShaharNaveh Mar 5, 2020

Choose a reason for hiding this comment

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

I am interested in doing that, anyone got a smart way of doing that?

Will do that in a follow-up PR.

Copy link
Member

Choose a reason for hiding this comment

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

for _ in range(10):
     n = np.random.randint(len(ser))
     assert res2.iloc[n] == ser.iloc[n] + offset

(10 is arbitrary number here, you decide what is reasonable number

@ShaharNaveh ShaharNaveh changed the title Tst tseries xfail TST: Fixed xfail for tests in pandas/tests/tseries/offsets/test_offsets_properties.py Mar 5, 2020
@simonjayhawkins simonjayhawkins added the Testing pandas testing functions or related to the test suite label Mar 5, 2020
@ShaharNaveh
Copy link
Member Author

mypy is failing?

@@ -101,7 +103,7 @@ def test_on_offset_implementations(dt, offset):


@pytest.mark.skipif(
dateutil.__version__ < "2.7",
DATEUTIL_VERSION < "2.7",
reason="hypothesis uses dateutil.tz.UTC which was intreduced in dateutils 2.7.0",
Copy link
Member

Choose a reason for hiding this comment

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

intreduced -> introduced

@@ -101,7 +103,7 @@ def test_on_offset_implementations(dt, offset):


@pytest.mark.skipif(
dateutil.__version__ < "2.7",
DATEUTIL_VERSION < "2.7",
Copy link
Member

Choose a reason for hiding this comment

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

can you use LooseVersion

@jbrockmendel
Copy link
Member

looks like the build logs have expired; can you rebase and we'll see if this is ready


# rng = pd.date_range(start='1/1/2000', periods=100000, freq='T')
# TODO: Remove this `warnings.simplefilter`
Copy link
Member

Choose a reason for hiding this comment

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

what are the conditions that will allow this?

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 can't remebmer why was this necessery, Ill remove it, and see if the CI passes

@jbrockmendel
Copy link
Member

Couple of comments, looks nearly there

@jbrockmendel
Copy link
Member

=================================== FAILURES ===================================
_______________________ test_apply_index_implementations _______________________
[gw1] linux -- Python 3.6.10 /home/vsts/miniconda3/envs/pandas-dev/bin/python

    @given(gen_yqm_offset, gen_date_range)
>   def test_apply_index_implementations(offset, rng):

pandas/tests/tseries/offsets/test_offsets_properties.py:99: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pandas/core/indexes/datetimes.py:974: in date_range
    **kwargs,
pandas/core/arrays/datetimes.py:412: in _generate_range
    index.asi8, tz, ambiguous=ambiguous, nonexistent=nonexistent
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   raise pytz.NonExistentTimeError(stamp)
E   pytz.exceptions.NonExistentTimeError: 1991-03-31 00:04:11.080387

pandas/_libs/tslibs/tzconversion.pyx:276: NonExistentTimeError

@alimcmaster1
Copy link
Member

Is this still active?

@jreback
Copy link
Contributor

jreback commented Jun 14, 2020

closing as stale; if you can continue pls ping / open a new PR.

@jreback jreback closed this Jun 14, 2020
@ShaharNaveh ShaharNaveh deleted the TST-tseries-xfail branch May 3, 2021 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants