From 41f81eb70108ace72c29e81ee5869dba2dc1ee9a Mon Sep 17 00:00:00 2001 From: jaredgoldman Date: Tue, 28 Feb 2023 14:14:05 -0500 Subject: [PATCH] Make write on exit default false --- piker/clearing/_paper_engine.py | 4 ++-- piker/pp.py | 2 +- tests/conftest.py | 2 +- tests/test_paper.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/piker/clearing/_paper_engine.py b/piker/clearing/_paper_engine.py index 79ef55f4..fc37f1e4 100644 --- a/piker/clearing/_paper_engine.py +++ b/piker/clearing/_paper_engine.py @@ -262,7 +262,7 @@ class PaperBoi(Struct): with ( open_trade_ledger(self.broker, 'paper') as ledger, - open_pps(self.broker, 'paper') as table + open_pps(self.broker, 'paper', True) as table ): ledger.update({oid: t.to_dict()}) # Write to pps toml right now @@ -530,7 +530,7 @@ async def trades_dialogue( ): - with open_pps(broker, 'paper', write_on_exit=False) as table: + with open_pps(broker, 'paper') as table: # save pps in local state _positions.update(table.pps) diff --git a/piker/pp.py b/piker/pp.py index 74c710d4..b4ab2d0c 100644 --- a/piker/pp.py +++ b/piker/pp.py @@ -880,7 +880,7 @@ class PpsEncoder(toml.TomlEncoder): def open_pps( brokername: str, acctid: str, - write_on_exit: bool = True, + write_on_exit: bool = False, ) -> Generator[PpTable, None, None]: ''' diff --git a/tests/conftest.py b/tests/conftest.py index e25c8840..8218ec16 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -171,7 +171,7 @@ def open_test_pikerd_and_ems( ) -@pytest.fixture(scope='session') +@pytest.fixture(scope='module') def delete_testing_dir(): ''' This fixture removes the temp directory diff --git a/tests/test_paper.py b/tests/test_paper.py index fbc06033..d1168502 100644 --- a/tests/test_paper.py +++ b/tests/test_paper.py @@ -114,7 +114,7 @@ def _assert( executions, ): with ( - open_pps(broker, account) as table, + open_pps(broker, account, write_on_exit=False) as table, ): ''' Assert multiple cases including pps,