Skip to content

Commit 9977da2

Browse files
committed
Fix nose test generator bug. Better error messages
Make error messages more specific. Previously, ``` ERROR: Test reading compressed tables from URL. ``` Now, ``` ERROR: Test reading compressed tables from URL: infer compression, python engine ``` Add `self` parameter to check_table. Fixes error in line 928 of _make_engine: ``` UnboundLocalError: local variable 'klass' referenced before assignment ```
1 parent 7ff1247 commit 9977da2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

pandas/io/tests/parser/test_network.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import os
99
import nose
10+
import functools
1011

1112
import pandas.util.testing as tm
1213
from pandas import DataFrame
@@ -31,12 +32,18 @@ def __init__(self):
3132

3233
def test_compressed_urls(self):
3334
"""Test reading compressed tables from URL."""
35+
# test_fxn is a workaround for more descriptive nose reporting.
36+
# See http://stackoverflow.com/a/37393684/4651668.
37+
test_fxn = functools.partial(self.check_table)
38+
3439
for compression, extension in self.compression_to_extension.items():
3540
url = self.base_url + extension
36-
yield self.check_table, url, compression
37-
yield self.check_table, url, 'infer'
41+
# args is a (compression, engine) tuple
42+
for args in [(compression, 'python'), ('infer', 'python')]:
43+
test_fxn.description = '{} compression, {} engine'.format(*args)
44+
yield (test_fxn, url) + args
3845

39-
def check_table(url, compression, engine='python'):
46+
def check_table(self, url, compression, engine):
4047
url_table = read_table(url, compression=compression, engine=engine)
4148
tm.assert_frame_equal(url_table, self.local_table)
4249

0 commit comments

Comments
 (0)