mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-26 13:18:31 +08:00
Every setup_logger needs a teardown_logger
This commit is contained in:
+15
-2
@@ -25,7 +25,9 @@ import pandas as pd
|
||||
|
||||
from zipline.utils.test_utils import (
|
||||
nullctx,
|
||||
setup_logger
|
||||
setup_logger,
|
||||
teardown_logger
|
||||
|
||||
)
|
||||
import zipline.utils.factory as factory
|
||||
import zipline.utils.simfactory as simfactory
|
||||
@@ -139,6 +141,9 @@ class TestMiscellaneousAPI(TestCase):
|
||||
concurrent=True,
|
||||
)
|
||||
|
||||
def tearDown(self):
|
||||
teardown_logger(self)
|
||||
|
||||
def test_get_environment(self):
|
||||
expected_env = {
|
||||
'arena': 'backtest',
|
||||
@@ -306,6 +311,9 @@ class TestTransformAlgorithm(TestCase):
|
||||
self.panel_source, self.panel = \
|
||||
factory.create_test_panel_source(self.sim_params)
|
||||
|
||||
def tearDown(self):
|
||||
teardown_logger(self)
|
||||
|
||||
def test_source_as_input(self):
|
||||
algo = TestRegisterTransformAlgorithm(
|
||||
sim_params=self.sim_params,
|
||||
@@ -427,7 +435,6 @@ class TestPositions(TestCase):
|
||||
def setUp(self):
|
||||
setup_logger(self)
|
||||
self.sim_params = factory.create_simulation_parameters(num_days=4)
|
||||
setup_logger(self)
|
||||
|
||||
trade_history = factory.create_trade_history(
|
||||
1,
|
||||
@@ -441,6 +448,9 @@ class TestPositions(TestCase):
|
||||
self.df_source, self.df = \
|
||||
factory.create_test_df_source(self.sim_params)
|
||||
|
||||
def tearDown(self):
|
||||
teardown_logger(self);
|
||||
|
||||
def test_empty_portfolio(self):
|
||||
algo = EmptyPositionsAlgorithm(sim_params=self.sim_params)
|
||||
daily_stats = algo.run(self.df)
|
||||
@@ -488,6 +498,9 @@ class TestAlgoScript(TestCase):
|
||||
'sid': 0,
|
||||
}
|
||||
|
||||
def tearDown(self):
|
||||
teardown_logger(self);
|
||||
|
||||
def test_noop(self):
|
||||
algo = TradingAlgorithm(initialize=initialize_noop,
|
||||
handle_data=handle_data_noop)
|
||||
|
||||
Reference in New Issue
Block a user