From 5a0ddcec781851009496ff0cdeb6763d07bb053f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20S=C3=A1nchez=20de=20Le=C3=B3n=20Peque?= Date: Thu, 5 Oct 2017 18:53:34 +0200 Subject: [PATCH] TST: Filter for ZiplineDeprecationWarning only For those cases in which other type of warnings (i.e.: RuntimeWarning, that could be thrown by NumPy) should not affect the tests results. --- tests/test_algorithm.py | 1 + tests/test_api_shim.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/tests/test_algorithm.py b/tests/test_algorithm.py index 499b3b410d..405fa1d748 100644 --- a/tests/test_algorithm.py +++ b/tests/test_algorithm.py @@ -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, diff --git a/tests/test_api_shim.py b/tests/test_api_shim.py index 614df1e057..f4a3a226ea 100644 --- a/tests/test_api_shim.py +++ b/tests/test_api_shim.py @@ -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) @@ -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) @@ -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) @@ -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( @@ -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( @@ -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) @@ -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) @@ -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(