Skip to content

Commit 55c809a

Browse files
committed
CI: Migrate to CircleCI 2.0
Backport of pandas-devgh-21814.
1 parent 2b28893 commit 55c809a

File tree

12 files changed

+217
-63
lines changed

12 files changed

+217
-63
lines changed

.circleci/config.yml

+147
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
version: 2
2+
jobs:
3+
4+
# --------------------------------------------------------------------------
5+
# 0. py27_compat
6+
# --------------------------------------------------------------------------
7+
py27_compat:
8+
docker:
9+
- image: continuumio/miniconda:latest
10+
# databases configuration
11+
- image: circleci/postgres:9.6.5-alpine-ram
12+
environment:
13+
POSTGRES_USER: postgres
14+
POSTGRES_DB: pandas_nosetest
15+
- image: circleci/mysql:8-ram
16+
environment:
17+
MYSQL_USER: "root"
18+
MYSQL_HOST: "localhost"
19+
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
20+
MYSQL_DATABASE: "pandas_nosetest"
21+
environment:
22+
JOB: "2.7_COMPAT"
23+
ENV_FILE: "ci/circle-27-compat.yaml"
24+
LOCALE_OVERRIDE: "it_IT.UTF-8"
25+
MINICONDA_DIR: /home/ubuntu/miniconda3
26+
steps:
27+
- checkout
28+
- run:
29+
name: build
30+
command: |
31+
./ci/install_circle.sh
32+
./ci/show_circle.sh
33+
- run:
34+
name: test
35+
command: ./ci/run_circle.sh --skip-slow --skip-network
36+
37+
# --------------------------------------------------------------------------
38+
# 1. py36_locale
39+
# --------------------------------------------------------------------------
40+
py36_locale:
41+
docker:
42+
- image: continuumio/miniconda:latest
43+
# databases configuration
44+
- image: circleci/postgres:9.6.5-alpine-ram
45+
environment:
46+
POSTGRES_USER: postgres
47+
POSTGRES_DB: pandas_nosetest
48+
- image: circleci/mysql:8-ram
49+
environment:
50+
MYSQL_USER: "root"
51+
MYSQL_HOST: "localhost"
52+
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
53+
MYSQL_DATABASE: "pandas_nosetest"
54+
55+
environment:
56+
JOB: "3.6_LOCALE"
57+
ENV_FILE: "ci/circle-36-locale.yaml"
58+
LOCALE_OVERRIDE: "zh_CN.UTF-8"
59+
MINICONDA_DIR: /home/ubuntu/miniconda3
60+
steps:
61+
- checkout
62+
- run:
63+
name: build
64+
command: |
65+
./ci/install_circle.sh
66+
./ci/show_circle.sh
67+
- run:
68+
name: test
69+
command: ./ci/run_circle.sh --skip-slow --skip-network
70+
71+
# --------------------------------------------------------------------------
72+
# 2. py36_locale_slow
73+
# --------------------------------------------------------------------------
74+
py36_locale_slow:
75+
docker:
76+
- image: continuumio/miniconda:latest
77+
# databases configuration
78+
- image: circleci/postgres:9.6.5-alpine-ram
79+
environment:
80+
POSTGRES_USER: postgres
81+
POSTGRES_DB: pandas_nosetest
82+
- image: circleci/mysql:8-ram
83+
environment:
84+
MYSQL_USER: "root"
85+
MYSQL_HOST: "localhost"
86+
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
87+
MYSQL_DATABASE: "pandas_nosetest"
88+
89+
environment:
90+
JOB: "3.6_LOCALE_SLOW"
91+
ENV_FILE: "ci/circle-36-locale_slow.yaml"
92+
LOCALE_OVERRIDE: "zh_CN.UTF-8"
93+
MINICONDA_DIR: /home/ubuntu/miniconda3
94+
steps:
95+
- checkout
96+
- run:
97+
name: build
98+
command: |
99+
./ci/install_circle.sh
100+
./ci/show_circle.sh
101+
- run:
102+
name: test
103+
command: ./ci/run_circle.sh --only-slow --skip-network
104+
105+
# --------------------------------------------------------------------------
106+
# 3. py35_ascii
107+
# --------------------------------------------------------------------------
108+
py35_ascii:
109+
docker:
110+
- image: continuumio/miniconda:latest
111+
# databases configuration
112+
- image: circleci/postgres:9.6.5-alpine-ram
113+
environment:
114+
POSTGRES_USER: postgres
115+
POSTGRES_DB: pandas_nosetest
116+
- image: circleci/mysql:8-ram
117+
environment:
118+
MYSQL_USER: "root"
119+
MYSQL_HOST: "localhost"
120+
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
121+
MYSQL_DATABASE: "pandas_nosetest"
122+
123+
environment:
124+
JOB: "3.5_ASCII"
125+
ENV_FILE: "ci/circle-35-ascii.yaml"
126+
LOCALE_OVERRIDE: "C"
127+
MINICONDA_DIR: /home/ubuntu/miniconda3
128+
steps:
129+
- checkout
130+
- run:
131+
name: build
132+
command: |
133+
./ci/install_circle.sh
134+
./ci/show_circle.sh
135+
- run:
136+
name: test
137+
command: ./ci/run_circle.sh --skip-slow --skip-network
138+
139+
140+
workflows:
141+
version: 2
142+
build_and_test:
143+
jobs:
144+
- py27_compat
145+
- py36_locale
146+
- py36_locale_slow
147+
- py35_ascii

ci/install_circle.sh

+10-9
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,7 @@ echo "[home_dir: $home_dir]"
66
echo "[ls -ltr]"
77
ls -ltr
88

9-
echo "[Using clean Miniconda install]"
10-
rm -rf "$MINICONDA_DIR"
11-
12-
# install miniconda
13-
wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -q -O miniconda.sh || exit 1
14-
bash miniconda.sh -b -p "$MINICONDA_DIR" || exit 1
15-
16-
export PATH="$MINICONDA_DIR/bin:$PATH"
9+
apt-get update -y && apt-get install -y build-essential postgresql-client-9.6
1710

1811
echo "[update conda]"
1912
conda config --set ssl_verify false || exit 1
@@ -48,9 +41,17 @@ source $ENVS_FILE
4841

4942
# edit the locale override if needed
5043
if [ -n "$LOCALE_OVERRIDE" ]; then
44+
45+
apt-get update && apt-get -y install locales locales-all
46+
47+
export LANG=$LOCALE_OVERRIDE
48+
export LC_ALL=$LOCALE_OVERRIDE
49+
50+
python -c "import locale; locale.setlocale(locale.LC_ALL, \"$LOCALE_OVERRIDE\")" || exit 1;
51+
5152
echo "[Adding locale to the first line of pandas/__init__.py]"
5253
rm -f pandas/__init__.pyc
53-
sedc="3iimport locale\nlocale.setlocale(locale.LC_ALL, '$LOCALE_OVERRIDE')\n"
54+
sedc="3iimport locale\nlocale.setlocale(locale.LC_ALL, \"$LOCALE_OVERRIDE\")\n"
5455
sed -i "$sedc" pandas/__init__.py
5556
echo "[head -4 pandas/__init__.py]"
5657
head -4 pandas/__init__.py

ci/install_db_circle.sh

-8
This file was deleted.

ci/run_circle.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ export PATH="$MINICONDA_DIR/bin:$PATH"
66
source activate pandas
77

88
echo "pytest --strict --junitxml=$CIRCLE_TEST_REPORTS/reports/junit.xml $@ pandas"
9-
pytest --strict --junitxml=$CIRCLE_TEST_REPORTS/reports/junit.xml $@ pandas
9+
pytest --strict --color=no --junitxml=$CIRCLE_TEST_REPORTS/reports/junit.xml $@ pandas

circle.yml

-38
This file was deleted.

pandas/tests/indexes/datetimes/test_misc.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import locale
22
import calendar
3+
import unicodedata
34

45
import pytest
56

67
import numpy as np
78
import pandas as pd
89
import pandas.util.testing as tm
910
from pandas import (Index, DatetimeIndex, datetime, offsets,
10-
date_range, Timestamp)
11+
date_range, Timestamp, compat)
1112

1213

1314
class TestTimeSeries(object):
@@ -284,10 +285,24 @@ def test_datetime_name_accessors(self, time_locale):
284285
dti = DatetimeIndex(freq='M', start='2012', end='2013')
285286
result = dti.month_name(locale=time_locale)
286287
expected = Index([month.capitalize() for month in expected_months])
288+
289+
# work around different normalization schemes
290+
# https://github.com/pandas-dev/pandas/issues/22342
291+
if not compat.PY2:
292+
result = result.str.normalize("NFD")
293+
expected = expected.str.normalize("NFD")
294+
287295
tm.assert_index_equal(result, expected)
296+
288297
for date, expected in zip(dti, expected_months):
289298
result = date.month_name(locale=time_locale)
290-
assert result == expected.capitalize()
299+
expected = expected.capitalize()
300+
301+
if not compat.PY2:
302+
result = unicodedata.normalize("NFD", result)
303+
expected = unicodedata.normalize("NFD", result)
304+
305+
assert result == expected
291306
dti = dti.append(DatetimeIndex([pd.NaT]))
292307
assert np.isnan(dti.month_name(locale=time_locale)[-1])
293308

pandas/tests/io/json/test_compression.py

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import pandas as pd
44
import pandas.util.testing as tm
5+
import pandas.util._test_decorators as td
56
from pandas.util.testing import assert_frame_equal, assert_raises_regex
67

78

@@ -31,6 +32,7 @@ def test_read_zipped_json(datapath):
3132
assert_frame_equal(uncompressed_df, compressed_df)
3233

3334

35+
@td.skip_if_not_us_locale
3436
def test_with_s3_url(compression):
3537
boto3 = pytest.importorskip('boto3')
3638
pytest.importorskip('s3fs')

pandas/tests/io/json/test_pandas.py

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
assert_series_equal, network,
1616
ensure_clean, assert_index_equal)
1717
import pandas.util.testing as tm
18+
import pandas.util._test_decorators as td
1819

1920
_seriesd = tm.getSeriesData()
2021
_tsd = tm.getTimeSeriesData()
@@ -1040,6 +1041,7 @@ def test_read_inline_jsonl(self):
10401041
expected = DataFrame([[1, 2], [1, 2]], columns=['a', 'b'])
10411042
assert_frame_equal(result, expected)
10421043

1044+
@td.skip_if_not_us_locale
10431045
def test_read_s3_jsonl(self, s3_resource):
10441046
# GH17200
10451047

pandas/tests/io/parser/test_network.py

+2
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,12 @@ def tips_df(datapath):
5555

5656

5757
@pytest.mark.usefixtures("s3_resource")
58+
@td.skip_if_not_us_locale()
5859
class TestS3(object):
5960

6061
def test_parse_public_s3_bucket(self, tips_df):
6162
pytest.importorskip('s3fs')
63+
6264
# more of an integration test due to the not-public contents portion
6365
# can probably mock this though.
6466
for ext, comp in [('', None), ('.gz', 'gzip'), ('.bz2', 'bz2')]:

pandas/tests/io/test_excel.py

+1
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,7 @@ def test_read_from_http_url(self, ext):
576576
tm.assert_frame_equal(url_table, local_table)
577577

578578
@td.skip_if_no('s3fs')
579+
@td.skip_if_not_us_locale
579580
def test_read_from_s3_url(self, ext):
580581
boto3 = pytest.importorskip('boto3')
581582
moto = pytest.importorskip('moto')

pandas/tests/scalar/timestamp/test_timestamp.py

+17-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import dateutil
66
import calendar
77
import locale
8+
import unicodedata
89
import numpy as np
910

1011
from dateutil.tz import tzutc
@@ -20,7 +21,7 @@
2021
from pandas._libs.tslibs.timezones import get_timezone, dateutil_gettz as gettz
2122

2223
from pandas.errors import OutOfBoundsDatetime
23-
from pandas.compat import long, PY3
24+
from pandas.compat import long, PY3, PY2
2425
from pandas.compat.numpy import np_datetime64_compat
2526
from pandas import Timestamp, Period, Timedelta, NaT
2627

@@ -116,8 +117,21 @@ def test_names(self, data, time_locale):
116117
expected_day = calendar.day_name[0].capitalize()
117118
expected_month = calendar.month_name[8].capitalize()
118119

119-
assert data.day_name(time_locale) == expected_day
120-
assert data.month_name(time_locale) == expected_month
120+
result_day = data.day_name(time_locale)
121+
result_month = data.month_name(time_locale)
122+
123+
# Work around https://github.com/pandas-dev/pandas/issues/22342
124+
# different normalizations
125+
126+
if not PY2:
127+
expected_day = unicodedata.normalize("NFD", expected_day)
128+
expected_month = unicodedata.normalize("NFD", expected_month)
129+
130+
result_day = unicodedata.normalize("NFD", result_day,)
131+
result_month = unicodedata.normalize("NFD", result_month)
132+
133+
assert result_day == expected_day
134+
assert result_month == expected_month
121135

122136
# Test NaT
123137
nan_ts = Timestamp(NaT)

0 commit comments

Comments
 (0)