From 68278a8672a1a15564f0d1b8c04b0ffd1fe2af0c Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Wed, 13 Mar 2019 09:16:53 -0500 Subject: [PATCH 1/5] fix MacPython pandas-wheels failure (#25186) (#25706) (cherry picked from commit 93568cc3c529a10a897879561b4cd75486c618be) --- pandas/tests/indexes/multi/test_analytics.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/tests/indexes/multi/test_analytics.py b/pandas/tests/indexes/multi/test_analytics.py index 632ab7aa7be7a..1b20e3f555647 100644 --- a/pandas/tests/indexes/multi/test_analytics.py +++ b/pandas/tests/indexes/multi/test_analytics.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from pandas.compat import lrange +from pandas.compat import PY2, lrange from pandas.compat.numpy import _np_version_under1p17 import pandas as pd @@ -267,6 +267,7 @@ def test_map_dictlike(idx, mapper): tm.assert_index_equal(result, expected) +@pytest.mark.skipif(PY2, reason="pytest.raises match regex fails") @pytest.mark.parametrize('func', [ np.exp, np.exp2, np.expm1, np.log, np.log2, np.log10, np.log1p, np.sqrt, np.sin, np.cos, np.tan, np.arcsin, From ecc9051b4eaec4f16005a559a3ef4d67889f5537 Mon Sep 17 00:00:00 2001 From: MeeseeksMachine <39504233+meeseeksmachine@users.noreply.github.com> Date: Wed, 13 Mar 2019 14:45:58 -0700 Subject: [PATCH 2/5] Backport PR #25714: #25707 - Fixed flakiness in stata write test (#25717) --- pandas/tests/io/test_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/io/test_common.py b/pandas/tests/io/test_common.py index 3354bca63be92..4051adc7ee4cb 100644 --- a/pandas/tests/io/test_common.py +++ b/pandas/tests/io/test_common.py @@ -251,7 +251,7 @@ def test_read_fspath_all_read_table(self, datapath): ('to_latex', {}, 'os'), ('to_msgpack', {}, 'os'), ('to_pickle', {}, 'os'), - ('to_stata', {}, 'os'), + ('to_stata', {'time_stamp': pd.to_datetime('2019-01-01 00:00')}, 'os'), ]) def test_write_fspath_all(self, writer_name, writer_kwargs, module): p1 = tm.ensure_clean('string') From aaec051a65c849a36bb415d9a1734921d56af4d9 Mon Sep 17 00:00:00 2001 From: Peter Leimbigler Date: Mon, 18 Mar 2019 00:42:57 -0400 Subject: [PATCH 3/5] Fix typo in docstring of DataFrame.memory_usage (#25761) --- pandas/core/frame.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index f5535096c967d..fb40c08aeb28a 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -2522,8 +2522,8 @@ def memory_usage(self, index=True, deep=False): ---------- index : bool, default True Specifies whether to include the memory usage of the DataFrame's - index in returned Series. If ``index=True`` the memory usage of the - index the first item in the output. + index in returned Series. If ``index=True``, the memory usage of + the index is the first item in the output. deep : bool, default False If True, introspect the data deeply by interrogating `object` dtypes for system-level memory consumption, and include From 95938db1160fef6099421e69a73a48a01f910613 Mon Sep 17 00:00:00 2001 From: William Ayd Date: Mon, 18 Mar 2019 07:45:41 -0700 Subject: [PATCH 4/5] Backport PR #25701: Pinned pycodestyle (#25713) --- environment.yml | 4 +++- requirements-dev.txt | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/environment.yml b/environment.yml index 47fe8e4c2a640..ff7c5d56052d2 100644 --- a/environment.yml +++ b/environment.yml @@ -19,7 +19,9 @@ dependencies: - hypothesis>=3.82 - isort - moto - - pytest>=4.0 + - pycodestyle=2.4 + - pytest>=4.0.2 + - pytest-mock - sphinx - numpydoc diff --git a/requirements-dev.txt b/requirements-dev.txt index 76aaeefa648f4..02d8b0a70aab6 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -10,7 +10,9 @@ gitpython hypothesis>=3.82 isort moto -pytest>=4.0 +pycodestyle==2.4 +pytest>=4.0.2 +pytest-mock sphinx numpydoc beautifulsoup4>=4.2.1 From 1ec04725e41ec072d899343c17bdbe38ce53832a Mon Sep 17 00:00:00 2001 From: MeeseeksMachine <39504233+meeseeksmachine@users.noreply.github.com> Date: Mon, 25 Mar 2019 17:24:18 -0700 Subject: [PATCH 5/5] Backport PR #25262: REF/TST: resample/test_base.py (#25718) --- pandas/tests/resample/test_base.py | 34 ++++++++++++++++-------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/pandas/tests/resample/test_base.py b/pandas/tests/resample/test_base.py index 911cd990ab881..809f3a00e925e 100644 --- a/pandas/tests/resample/test_base.py +++ b/pandas/tests/resample/test_base.py @@ -28,15 +28,10 @@ period_range, 'pi', datetime(2005, 1, 1), datetime(2005, 1, 10)) TIMEDELTA_RANGE = (timedelta_range, 'tdi', '1 day', '10 day') -ALL_TIMESERIES_INDEXES = [DATE_RANGE, PERIOD_RANGE, TIMEDELTA_RANGE] - - -def pytest_generate_tests(metafunc): - # called once per each test function - if metafunc.function.__name__.endswith('_all_ts'): - metafunc.parametrize( - '_index_factory,_series_name,_index_start,_index_end', - ALL_TIMESERIES_INDEXES) +all_ts = pytest.mark.parametrize( + '_index_factory,_series_name,_index_start,_index_end', + [DATE_RANGE, PERIOD_RANGE, TIMEDELTA_RANGE] +) @pytest.fixture @@ -84,7 +79,8 @@ def test_asfreq_fill_value(series, create_index): assert_frame_equal(result, expected) -def test_resample_interpolate_all_ts(frame): +@all_ts +def test_resample_interpolate(frame): # # 12925 df = frame assert_frame_equal( @@ -98,8 +94,9 @@ def test_raises_on_non_datetimelike_index(): pytest.raises(TypeError, lambda: xp.resample('A').mean()) +@all_ts @pytest.mark.parametrize('freq', ['M', 'D', 'H']) -def test_resample_empty_series_all_ts(freq, empty_series, resample_method): +def test_resample_empty_series(freq, empty_series, resample_method): # GH12771 & GH12868 if resample_method == 'ohlc': @@ -118,8 +115,9 @@ def test_resample_empty_series_all_ts(freq, empty_series, resample_method): assert_series_equal(result, expected, check_dtype=False) +@all_ts @pytest.mark.parametrize('freq', ['M', 'D', 'H']) -def test_resample_empty_dataframe_all_ts(empty_frame, freq, resample_method): +def test_resample_empty_dataframe(empty_frame, freq, resample_method): # GH13212 df = empty_frame # count retains dimensions too @@ -159,7 +157,8 @@ def test_resample_empty_dtypes(index, dtype, resample_method): pass -def test_resample_loffset_arg_type_all_ts(frame, create_index): +@all_ts +def test_resample_loffset_arg_type(frame, create_index): # GH 13218, 15002 df = frame expected_means = [df.values[i:i + 2].mean() @@ -197,7 +196,8 @@ def test_resample_loffset_arg_type_all_ts(frame, create_index): assert_frame_equal(result_how, expected) -def test_apply_to_empty_series_all_ts(empty_series): +@all_ts +def test_apply_to_empty_series(empty_series): # GH 14313 s = empty_series for freq in ['M', 'D', 'H']: @@ -207,7 +207,8 @@ def test_apply_to_empty_series_all_ts(empty_series): assert_series_equal(result, expected, check_dtype=False) -def test_resampler_is_iterable_all_ts(series): +@all_ts +def test_resampler_is_iterable(series): # GH 15314 freq = 'H' tg = TimeGrouper(freq, convention='start') @@ -218,7 +219,8 @@ def test_resampler_is_iterable_all_ts(series): assert_series_equal(rv, gv) -def test_resample_quantile_all_ts(series): +@all_ts +def test_resample_quantile(series): # GH 15023 s = series q = 0.75