Skip to content

Commit e07dc19

Browse files
committed
Merge pull request pandas-dev#4381 from cpcloud/undefined-runs-in-network-decorator
TST/BUG: fix NameError in network decorator
2 parents c066ada + 6bb024e commit e07dc19

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

doc/source/release.rst

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ pandas 0.13
6262
- Fixed an issue where ``DataFrame.sum`` was slower than ``DataFrame.mean``
6363
for integer valued frames (:issue:`4365`)
6464
- ``read_html`` tests now work with Python 2.6 (:issue:`4351`)
65+
- Fixed bug where ``network`` testing was throwing ``NameError`` because a
66+
local variable was undefined (:issue:`4381`)
6567

6668
pandas 0.12
6769
===========

doc/source/v0.13.0.txt

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ Bug Fixes
4343

4444
- ``read_html`` tests now work with Python 2.6 (:issue:`4351`)
4545

46+
- Fixed bug where ``network`` testing was throwing ``NameError`` because a
47+
local variable was undefined (:issue:`4381`)
48+
4649
See the :ref:`full release notes
4750
<release>` or issue tracker
4851
on GitHub for a complete list.

pandas/util/testing.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from datetime import datetime
1414
from functools import wraps
15-
from contextlib import contextmanager, closing
15+
from contextlib import contextmanager
1616
from httplib import HTTPException
1717
from urllib2 import urlopen
1818
from distutils.version import LooseVersion
@@ -31,8 +31,6 @@
3131
from pandas.tseries.index import DatetimeIndex
3232
from pandas.tseries.period import PeriodIndex
3333

34-
from pandas.io.common import urlopen
35-
3634
Index = index.Index
3735
MultiIndex = index.MultiIndex
3836
Series = series.Series
@@ -767,6 +765,8 @@ def network_wrapper(*args, **kwargs):
767765
if raise_on_error:
768766
return t(*args, **kwargs)
769767
else:
768+
runs = 0
769+
770770
for _ in range(num_runs):
771771
try:
772772
try:
@@ -781,6 +781,8 @@ def network_wrapper(*args, **kwargs):
781781
else:
782782
raise
783783

784+
runs += 1
785+
784786
return network_wrapper
785787

786788

0 commit comments

Comments
 (0)