-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: skip gbq test again / fix parsers/test_network url #15407
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,42 +15,36 @@ | |
from pandas.io.parsers import read_csv, read_table | ||
|
||
|
||
class TestCompressedUrl(object): | ||
@pytest.fixture(scope='module') | ||
def salaries_table(): | ||
path = os.path.join(tm.get_data_path(), 'salaries.csv') | ||
return read_table(path) | ||
|
||
compression_to_extension = { | ||
'gzip': '.gz', | ||
'bz2': '.bz2', | ||
'zip': '.zip', | ||
'xz': '.xz', | ||
} | ||
|
||
def setup(self): | ||
path = os.path.join(tm.get_data_path(), 'salaries.csv') | ||
self.local_table = read_table(path) | ||
self.base_url = ('https://github.com/pandas-dev/pandas/raw/master/' | ||
'pandas/io/tests/parser/data/salaries.csv') | ||
@pytest.mark.parametrize( | ||
"compression,extension", [('gzip', '.gz'), ('bz2', '.bz2'), | ||
('zip', '.zip'), ('xz', '.xz')]) | ||
def test_compressed_urls(salaries_table, compression, extension): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @TomAugspurger I had to do this in an odd way (meaning having the parameterized fixed call another function) as the any idea? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIRC, decorators need to fully copy the whole argument signature. This is not too bad on Python 3.4+ because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @QuLogic thanks for the expl. yeah I think we need to fix There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so you just use if its only for testing purposes, then we could easily do that (though even easier would be to fix our There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The syntax of |
||
check_compressed_urls(salaries_table, compression, extension) | ||
|
||
|
||
@tm.network | ||
def check_compressed_urls(salaries_table, compression, extension): | ||
# test reading compressed urls with various engines and | ||
# extension inference | ||
base_url = ('https://github.com/pandas-dev/pandas/raw/master/' | ||
'pandas/tests/io/parser/data/salaries.csv') | ||
|
||
url = base_url + extension | ||
|
||
# args is a (compression, engine) tuple | ||
for (c, engine) in product([compression, 'infer'], ['python', 'c']): | ||
|
||
@tm.network | ||
def test_compressed_urls(self): | ||
# Test reading compressed tables from URL. | ||
msg = ('Test reading {}-compressed tables from URL: ' | ||
'compression="{}", engine="{}"') | ||
|
||
for compression, extension in self.compression_to_extension.items(): | ||
url = self.base_url + extension | ||
# args is a (compression, engine) tuple | ||
for args in product([compression, 'infer'], ['python', 'c']): | ||
# test_fxn is a workaround for more descriptive nose reporting. | ||
# See http://stackoverflow.com/a/37393684/4651668. | ||
test_fxn = functools.partial(self.check_table) | ||
test_fxn.description = msg.format(compression, *args) | ||
yield (test_fxn, url) + args | ||
|
||
def check_table(self, url, compression, engine): | ||
if url.endswith('.xz'): | ||
tm._skip_if_no_lzma() | ||
url_table = read_table(url, compression=compression, engine=engine) | ||
tm.assert_frame_equal(url_table, self.local_table) | ||
|
||
url_table = read_table(url, compression=c, engine=engine) | ||
tm.assert_frame_equal(url_table, salaries_table) | ||
|
||
|
||
class TestS3(tm.TestCase): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TomAugspurger FYI