Skip to content

Commit 9340f38

Browse files
author
samatix
committed
DEP: Add a condition to use self.assertRaisesRegexp for python 2.7
1 parent 86ddd60 commit 9340f38

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

tests/pipeline/test_pipeline.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from unittest import TestCase
55

66
from mock import patch
7+
from six import PY2
78

89
from zipline.pipeline import Factor, Filter, Pipeline
910
from zipline.pipeline.data import Column, DataSet, USEquityPricing
@@ -43,6 +44,10 @@ class SomeOtherFilter(Filter):
4344

4445
class PipelineTestCase(TestCase):
4546

47+
if PY2:
48+
def assertRaisesRegex(self, *args, **kwargs):
49+
return self.assertRaisesRegexp(*args, **kwargs)
50+
4651
def test_construction(self):
4752
p0 = Pipeline()
4853
self.assertEqual(p0.columns, {})

zipline/testing/fixtures.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from logbook import NullHandler, Logger
88
import numpy as np
99
import pandas as pd
10-
from six import with_metaclass, iteritems, itervalues
10+
from six import with_metaclass, iteritems, itervalues, PY2
1111
import responses
1212
from toolz import flip, groupby, merge
1313
from trading_calendars import (
@@ -251,6 +251,10 @@ def add_instance_callback(self, callback):
251251
"""
252252
return self._instance_teardown_stack.callback(callback)
253253

254+
if PY2:
255+
def assertRaisesRegex(self, *args, **kwargs):
256+
return self.assertRaisesRegexp(*args, **kwargs)
257+
254258

255259
def alias(attr_name):
256260
"""Make a fixture attribute an alias of another fixture's attribute by

0 commit comments

Comments
 (0)