Skip to content

Commit

Permalink
TST: Filter for ZiplineDeprecationWarning only
Browse files Browse the repository at this point in the history
For those cases in which other type of warnings (i.e.: RuntimeWarning,
that could be thrown by NumPy) should not affect the tests results.
  • Loading branch information
Peque committed Oct 5, 2017
1 parent 94f9ae5 commit 5a0ddce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/test_algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2294,6 +2294,7 @@ def handle_data(algo, data):

with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("ignore", PerformanceWarning)
warnings.simplefilter("ignore", RuntimeWarning)

algo = TradingAlgorithm(
script=algocode,
Expand Down
8 changes: 8 additions & 0 deletions tests/test_api_shim.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ def test_sid_accessor(self):
"""
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("ignore", PerformanceWarning)
warnings.simplefilter("ignore", RuntimeWarning)
warnings.simplefilter("default", ZiplineDeprecationWarning)
algo = self.create_algo(sid_accessor_algo)
algo.run(self.data_portal)
Expand Down Expand Up @@ -343,6 +344,7 @@ def test_data_items(self):
"""
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("ignore", PerformanceWarning)
warnings.simplefilter("ignore", RuntimeWarning)
warnings.simplefilter("default", ZiplineDeprecationWarning)
algo = self.create_algo(data_items_algo)
algo.run(self.data_portal)
Expand All @@ -368,6 +370,7 @@ def test_data_items(self):
def test_iterate_data(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("ignore", PerformanceWarning)
warnings.simplefilter("ignore", RuntimeWarning)
warnings.simplefilter("default", ZiplineDeprecationWarning)

algo = self.create_algo(simple_algo)
Expand Down Expand Up @@ -399,6 +402,7 @@ def test_iterate_data(self):
def test_history(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("ignore", PerformanceWarning)
warnings.simplefilter("ignore", RuntimeWarning)
warnings.simplefilter("default", ZiplineDeprecationWarning)

sim_params = self.sim_params.create_new(
Expand Down Expand Up @@ -441,6 +445,7 @@ def test_old_new_history_bts_paths(self):
def test_simple_transforms(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("ignore", PerformanceWarning)
warnings.simplefilter("ignore", RuntimeWarning)
warnings.simplefilter("default", ZiplineDeprecationWarning)

sim_params = SimulationParameters(
Expand Down Expand Up @@ -512,6 +517,7 @@ def test_simple_transforms(self):
def test_manipulation(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("ignore", PerformanceWarning)
warnings.simplefilter("ignore", RuntimeWarning)
warnings.simplefilter("default", ZiplineDeprecationWarning)

algo = self.create_algo(simple_algo)
Expand All @@ -534,6 +540,7 @@ def test_manipulation(self):

def test_reference_empty_position_by_int(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("ignore", RuntimeWarning)
warnings.simplefilter("default", ZiplineDeprecationWarning)

algo = self.create_algo(reference_missing_position_by_int_algo)
Expand All @@ -548,6 +555,7 @@ def test_reference_empty_position_by_int(self):

def test_reference_empty_position_by_unexpected_type(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("ignore", RuntimeWarning)
warnings.simplefilter("default", ZiplineDeprecationWarning)

algo = self.create_algo(
Expand Down

0 comments on commit 5a0ddce

Please sign in to comment.