Skip to content

Commit e322630

Browse files
victorjorisvandenbossche
victor
authored andcommitted
Null context manager implementation.
1 parent f38b4cb commit e322630

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

pandas/util/testing.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,17 @@
4848
from pandas._libs import testing as _testing
4949
from pandas.io.common import urlopen
5050

51-
if sys.version_info >= (3, 3):
52-
from contextlib import ExitStack as nullcontext
53-
else:
54-
from contextlib2 import ExitStack as nullcontext
51+
52+
class NullContextManager(object):
53+
def __init__(self, dummy_resource=None):
54+
self.dummy_resource = dummy_resource
55+
def __enter__(self):
56+
return self.dummy_resource
57+
def __exit__(self, *args):
58+
pass
5559

5660

57-
do_not_raise = nullcontext()
61+
do_not_raise = NullContextManager()
5862

5963

6064
N = 30

0 commit comments

Comments
 (0)