Skip to content

Commit 6211584

Browse files
committed
MAINT: Update requirements
Update requirements to reflect testing
1 parent 09ab475 commit 6211584

File tree

9 files changed

+35
-43
lines changed

9 files changed

+35
-43
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ install:
4646

4747
script:
4848
- if [[ -n "${TEST_TYPE+x}" ]]; then export MARKERS="-m ${TEST_TYPE}"; fi
49-
- pytest -s -r xX "${MARKERS}" --cov-config .coveragerc --cov=pandas_datareader --cov-report xml:/tmp/cov-datareader.xml --junitxml=/tmp/datareader.xml
49+
- pytest -v -s -r xX "${MARKERS}" --cov-config .coveragerc --cov=pandas_datareader --cov-report xml:/tmp/cov-datareader.xml --junitxml=/tmp/datareader.xml
5050
- |
5151
if [[ "$TRAVIS_PYTHON_VERSION" -gt 3.5 ]]; then
5252
black --check pandas_datareader

pandas_datareader/base.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
1212
_init_session,
1313
_sanitize_dates,
1414
)
15-
from pandas_datareader.compat import StringIO, binary_type, bytes_to_str, string_types
15+
from pandas_datareader.compat import (
16+
PANDAS_0230,
17+
StringIO,
18+
binary_type,
19+
bytes_to_str,
20+
string_types,
21+
)
1622

1723

1824
class _BaseReader(object):
@@ -260,7 +266,10 @@ def _dl_mult_symbols(self, symbols):
260266
df_na[:] = np.nan
261267
for sym in failed:
262268
stocks[sym] = df_na
263-
result = concat(stocks).unstack(level=0)
269+
if PANDAS_0230:
270+
result = concat(stocks, sort=True).unstack(level=0)
271+
else:
272+
result = concat(stocks).unstack(level=0)
264273
result.columns.names = ["Attributes", "Symbols"]
265274
return result
266275
except AttributeError:

pandas_datareader/compat/__init__.py

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,31 @@
22
import sys
33

44
import pandas as pd
5+
from pandas.api.types import is_list_like, is_number
56
import pandas.io.common as com
7+
from pandas.util.testing import assert_frame_equal
68

79
PY3 = sys.version_info >= (3, 0)
810

911
PANDAS_VERSION = LooseVersion(pd.__version__)
1012

11-
PANDAS_0190 = PANDAS_VERSION >= LooseVersion("0.19.0")
12-
PANDAS_0200 = PANDAS_VERSION >= LooseVersion("0.20.0")
1313
PANDAS_0210 = PANDAS_VERSION >= LooseVersion("0.21.0")
14+
PANDAS_0220 = PANDAS_VERSION >= LooseVersion("0.22.0")
1415
PANDAS_0230 = PANDAS_VERSION >= LooseVersion("0.23.0")
1516

16-
if PANDAS_0190:
17-
from pandas.api.types import is_number
18-
from pandas.util.testing import assert_frame_equal
19-
else:
20-
from pandas.core.common import is_number
21-
from pandas.testing import assert_frame_equal
22-
23-
if PANDAS_0200:
24-
from pandas.util.testing import assert_raises_regex
2517

26-
def get_filepath_or_buffer(filepath_or_buffer, encoding=None, compression=None):
18+
def get_filepath_or_buffer(filepath_or_buffer, encoding=None, compression=None):
2719

28-
# Dictionaries are no longer considered valid inputs
29-
# for "get_filepath_or_buffer" starting in pandas >= 0.20.0
30-
if isinstance(filepath_or_buffer, dict):
31-
return filepath_or_buffer, encoding, compression
20+
# Dictionaries are no longer considered valid inputs
21+
# for "get_filepath_or_buffer" starting in pandas >= 0.20.0
22+
if isinstance(filepath_or_buffer, dict):
23+
return filepath_or_buffer, encoding, compression
3224

33-
return com.get_filepath_or_buffer(
34-
filepath_or_buffer, encoding=encoding, compression=None
35-
)
25+
return com.get_filepath_or_buffer(
26+
filepath_or_buffer, encoding=encoding, compression=None
27+
)
3628

3729

38-
else:
39-
from pandas.util.testing import assertRaisesRegexp as assert_raises_regex
40-
41-
get_filepath_or_buffer = com.get_filepath_or_buffer
42-
43-
if PANDAS_0190:
44-
from pandas.api.types import is_list_like
45-
else:
46-
from pandas.core.common import is_list_like
47-
4830
if PY3:
4931
from urllib.error import HTTPError
5032
from functools import reduce

pandas_datareader/tests/test_eurostat.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import pandas.util.testing as tm
44
import pytest
55

6-
from pandas_datareader.compat import assert_raises_regex
76
import pandas_datareader.data as web
87

98
pytestmark = pytest.mark.stable
@@ -146,7 +145,7 @@ def test_get_nrg_pc_202(self):
146145
def test_get_prc_hicp_manr_exceeds_limit(self):
147146
# see gh-149
148147
msg = "Query size exceeds maximum limit"
149-
with assert_raises_regex(ValueError, msg):
148+
with pytest.raises(ValueError, match=msg):
150149
web.DataReader(
151150
"prc_hicp_manr",
152151
"eurostat",

pandas_datareader/tests/test_wb.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from pandas_datareader._testing import skip_on_exception
1010
from pandas_datareader._utils import RemoteDataError
11-
from pandas_datareader.compat import assert_raises_regex
1211
from pandas_datareader.wb import (
1312
WorldBankReader,
1413
download,
@@ -17,6 +16,8 @@
1716
search,
1817
)
1918

19+
pytestmark = pytest.mark.stable
20+
2021

2122
class TestWB(object):
2223
def test_wdi_search(self):
@@ -138,7 +139,7 @@ def test_wdi_download_error_handling(self):
138139
inds = "NY.GDP.PCAP.CD"
139140

140141
msg = "Invalid Country Code\\(s\\): XX"
141-
with assert_raises_regex(ValueError, msg):
142+
with pytest.raises(ValueError, match=msg):
142143
download(
143144
country=cntry_codes,
144145
indicator=inds,
@@ -158,7 +159,7 @@ def test_wdi_download_error_handling(self):
158159
inds = ["NY.GDP.PCAP.CD", "BAD_INDICATOR"]
159160

160161
msg = "The provided parameter value is not valid\\. " "Indicator: BAD_INDICATOR"
161-
with assert_raises_regex(ValueError, msg):
162+
with pytest.raises(ValueError, match=msg):
162163
download(
163164
country=cntry_codes,
164165
indicator=inds,
@@ -262,8 +263,8 @@ def test_wdi_get_indicators(self):
262263
"topics",
263264
]
264265
)
265-
# assert_index_equal doesn't exists
266-
assert result.columns.equals(exp_col)
266+
# Column order is version dependent, so check columns are present
267+
assert sorted(result.columns) == sorted(exp_col)
267268
assert len(result) > 10000
268269

269270
@skip_on_exception(RemoteDataError)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
lxml
2-
pandas>=0.19.2
2+
pandas>=0.21
33
pytest>=4.0.2
44
requests>=2.3.0
55
wrapt

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ testpaths = pandas_datareader
2929
markers =
3030
stable: mark a test as applying to a stable reader
3131
requires_api_key: mark a test as requiring an API key
32+
alpha_vantage: mark a test of the AlphaVantage reader
33+
quandl: mark a test of the Quandl readaer

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ def readme():
3535
'Environment :: Console',
3636
'Intended Audience :: Science/Research',
3737
'Operating System :: OS Independent',
38-
'Programming Language :: Cython',
3938
'Programming Language :: Python',
4039
'Programming Language :: Python :: 2',
4140
'Programming Language :: Python :: 2.7',

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[tox]
2-
envlist=py{27,35,36}
2+
envlist=py{27,35,36,37}
33

44
[testenv]
55
commands=
66
pytest
77
deps=
8-
pytest
8+
pytest>=4.0.2
99
pytest-cov
1010
wrapt

0 commit comments

Comments
 (0)