Skip to content

Commit f2839fe

Browse files
datapythonistajreback
authored andcommitted
CI: Fixing possible bugs in the CI (#23727)
1 parent dc0674d commit f2839fe

File tree

5 files changed

+58
-33
lines changed

5 files changed

+58
-33
lines changed

ci/azure/linux.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
CONDA_ENV: pandas
1616
TEST_ARGS: "--skip-slow --skip-network"
1717

18-
py36_locale:
18+
py37_locale:
1919
ENV_FILE: ci/deps/azure-37-locale.yaml
2020
CONDA_PY: "37"
2121
CONDA_ENV: pandas
@@ -27,6 +27,7 @@ jobs:
2727
CONDA_PY: "36"
2828
CONDA_ENV: pandas
2929
TEST_ARGS: "--only-slow --skip-network"
30+
LOCALE_OVERRIDE: "it_IT.UTF-8"
3031

3132
steps:
3233
- script: |

ci/deps/azure-37-locale.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies:
1818
- pymysql
1919
- pytables
2020
- python-dateutil
21-
- python=3.6*
21+
- python=3.7*
2222
- pytz
2323
- s3fs
2424
- scipy
@@ -30,6 +30,6 @@ dependencies:
3030
# universal
3131
- pytest
3232
- pytest-xdist
33-
- moto
3433
- pip:
3534
- hypothesis>=3.58.0
35+
- moto # latest moto in conda-forge fails with 3.7, move to conda dependencies when this is fixed

ci/script_multi.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ source activate pandas
66

77
if [ -n "$LOCALE_OVERRIDE" ]; then
88
export LC_ALL="$LOCALE_OVERRIDE";
9+
export LANG="$LOCALE_OVERRIDE";
910
echo "Setting LC_ALL to $LOCALE_OVERRIDE"
1011

1112
pycmd='import pandas; print("pandas detected console encoding: %s" % pandas.get_option("display.encoding"))'
@@ -32,8 +33,12 @@ elif [ "$COVERAGE" ]; then
3233

3334
elif [ "$SLOW" ]; then
3435
TEST_ARGS="--only-slow --skip-network"
35-
echo pytest -m "not single and slow" -v --durations=10 --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
36-
pytest -m "not single and slow" -v --durations=10 --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
36+
# The `-m " and slow"` is redundant here, as `--only-slow` is already used (via $TEST_ARGS). But is needed, because with
37+
# `--only-slow` fast tests are skipped, but each of them is printed in the log (which can be avoided with `-q`),
38+
# and also added to `test-data-multiple.xml`, and then printed in the log in the call to `ci/print_skipped.py`.
39+
# Printing them to the log makes the log exceed the maximum size allowed by Travis and makes the build fail.
40+
echo pytest -n 2 -m "not single and slow" --durations=10 --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
41+
pytest -n 2 -m "not single and slow" --durations=10 --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
3742

3843
else
3944
echo pytest -n 2 -m "not single" --durations=10 --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas

pandas/tests/io/test_excel.py

+47-27
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
# pylint: disable=E1101
2-
import os
3-
import warnings
4-
from datetime import datetime, date, time, timedelta
1+
from collections import OrderedDict
2+
import contextlib
3+
from datetime import date, datetime, time, timedelta
54
from distutils.version import LooseVersion
65
from functools import partial
6+
import os
7+
import warnings
78
from warnings import catch_warnings
8-
from collections import OrderedDict
99

1010
import numpy as np
11-
import pytest
1211
from numpy import nan
12+
import pytest
1313

14-
import pandas as pd
15-
import pandas.util.testing as tm
14+
from pandas.compat import PY36, BytesIO, iteritems, map, range, u
1615
import pandas.util._test_decorators as td
16+
17+
import pandas as pd
1718
from pandas import DataFrame, Index, MultiIndex, Series
18-
from pandas.compat import u, range, map, BytesIO, iteritems, PY36
19-
from pandas.core.config import set_option, get_option
19+
from pandas.core.config import get_option, set_option
20+
import pandas.util.testing as tm
21+
from pandas.util.testing import ensure_clean, makeCustomDataframe as mkdf
22+
2023
from pandas.io.common import URLError
2124
from pandas.io.excel import (
22-
ExcelFile, ExcelWriter, read_excel, _XlwtWriter, _OpenpyxlWriter,
23-
register_writer, _XlsxWriter
24-
)
25+
ExcelFile, ExcelWriter, _OpenpyxlWriter, _XlsxWriter, _XlwtWriter,
26+
read_excel, register_writer)
2527
from pandas.io.formats.excel import ExcelFormatter
2628
from pandas.io.parsers import read_csv
27-
from pandas.util.testing import ensure_clean, makeCustomDataframe as mkdf
28-
2929

3030
_seriesd = tm.getSeriesData()
3131
_tsd = tm.getTimeSeriesData()
@@ -36,6 +36,20 @@
3636
_mixed_frame['foo'] = 'bar'
3737

3838

39+
@contextlib.contextmanager
40+
def ignore_xlrd_time_clock_warning():
41+
"""
42+
Context manager to ignore warnings raised by the xlrd library,
43+
regarding the deprecation of `time.clock` in Python 3.7.
44+
"""
45+
with warnings.catch_warnings():
46+
warnings.filterwarnings(
47+
action='ignore',
48+
message='time.clock has been deprecated',
49+
category=DeprecationWarning)
50+
yield
51+
52+
3953
@td.skip_if_no('xlrd', '1.0.0')
4054
class SharedItems(object):
4155

@@ -114,20 +128,23 @@ def test_usecols_int(self, ext):
114128
# usecols as int
115129
with tm.assert_produces_warning(FutureWarning,
116130
check_stacklevel=False):
117-
df1 = self.get_exceldf("test1", ext, "Sheet1",
118-
index_col=0, usecols=3)
131+
with ignore_xlrd_time_clock_warning():
132+
df1 = self.get_exceldf("test1", ext, "Sheet1",
133+
index_col=0, usecols=3)
119134

120135
# usecols as int
121136
with tm.assert_produces_warning(FutureWarning,
122137
check_stacklevel=False):
123-
df2 = self.get_exceldf("test1", ext, "Sheet2", skiprows=[1],
124-
index_col=0, usecols=3)
138+
with ignore_xlrd_time_clock_warning():
139+
df2 = self.get_exceldf("test1", ext, "Sheet2", skiprows=[1],
140+
index_col=0, usecols=3)
125141

126142
# parse_cols instead of usecols, usecols as int
127143
with tm.assert_produces_warning(FutureWarning,
128144
check_stacklevel=False):
129-
df3 = self.get_exceldf("test1", ext, "Sheet2", skiprows=[1],
130-
index_col=0, parse_cols=3)
145+
with ignore_xlrd_time_clock_warning():
146+
df3 = self.get_exceldf("test1", ext, "Sheet2", skiprows=[1],
147+
index_col=0, parse_cols=3)
131148

132149
# TODO add index to xls file)
133150
tm.assert_frame_equal(df1, df_ref, check_names=False)
@@ -145,8 +162,9 @@ def test_usecols_list(self, ext):
145162
index_col=0, usecols=[0, 2, 3])
146163

147164
with tm.assert_produces_warning(FutureWarning):
148-
df3 = self.get_exceldf('test1', ext, 'Sheet2', skiprows=[1],
149-
index_col=0, parse_cols=[0, 2, 3])
165+
with ignore_xlrd_time_clock_warning():
166+
df3 = self.get_exceldf('test1', ext, 'Sheet2', skiprows=[1],
167+
index_col=0, parse_cols=[0, 2, 3])
150168

151169
# TODO add index to xls file)
152170
tm.assert_frame_equal(df1, dfref, check_names=False)
@@ -165,8 +183,9 @@ def test_usecols_str(self, ext):
165183
index_col=0, usecols='A:D')
166184

167185
with tm.assert_produces_warning(FutureWarning):
168-
df4 = self.get_exceldf('test1', ext, 'Sheet2', skiprows=[1],
169-
index_col=0, parse_cols='A:D')
186+
with ignore_xlrd_time_clock_warning():
187+
df4 = self.get_exceldf('test1', ext, 'Sheet2', skiprows=[1],
188+
index_col=0, parse_cols='A:D')
170189

171190
# TODO add index to xls, read xls ignores index name ?
172191
tm.assert_frame_equal(df2, df1, check_names=False)
@@ -618,8 +637,9 @@ def test_sheet_name_and_sheetname(self, ext):
618637
df1 = self.get_exceldf(filename, ext,
619638
sheet_name=sheet_name, index_col=0) # doc
620639
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
621-
df2 = self.get_exceldf(filename, ext, index_col=0,
622-
sheetname=sheet_name) # backward compat
640+
with ignore_xlrd_time_clock_warning():
641+
df2 = self.get_exceldf(filename, ext, index_col=0,
642+
sheetname=sheet_name) # backward compat
623643

624644
excel = self.get_excelfile(filename, ext)
625645
df1_parse = excel.parse(sheet_name=sheet_name, index_col=0) # doc

setup.cfg

-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ skip=
175175
pandas/tests/io/test_parquet.py,
176176
pandas/tests/io/generate_legacy_storage_files.py,
177177
pandas/tests/io/test_common.py,
178-
pandas/tests/io/test_excel.py,
179178
pandas/tests/io/test_feather.py,
180179
pandas/tests/io/test_s3.py,
181180
pandas/tests/io/test_html.py,

0 commit comments

Comments
 (0)