Skip to content

Commit 89f983f

Browse files
committed
fix: add teardown_sqlalchemy to RunTestBase to prevent stale DB on Windows
RunTestBase.tearDown() was calling shutil.rmtree with ignore_errors=True but without first releasing the SQLite file lock via teardown_sqlalchemy(). On Windows, this left the database file behind, causing the next test to find a stale BITVAVO portfolio when expecting BINANCE.
1 parent a70fba4 commit 89f983f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

tests/app/test_run.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
from investing_algorithm_framework import create_app, TradingStrategy, \
1616
TimeUnit, PortfolioConfiguration, RESOURCE_DIRECTORY, \
1717
Algorithm, MarketCredential
18+
from investing_algorithm_framework.infrastructure.database import \
19+
teardown_sqlalchemy
1820
from tests.resources import random_string, OrderExecutorTest, \
1921
PortfolioProviderTest
2022

@@ -105,6 +107,7 @@ def setUp(self) -> None:
105107

106108
def tearDown(self) -> None:
107109
super().tearDown()
110+
teardown_sqlalchemy()
108111
for subdir in ("databases", "backtest_databases"):
109112
path = os.path.join(self.resource_dir, subdir)
110113
if os.path.exists(path):

0 commit comments

Comments
 (0)