Skip to content

Commit eea4417

Browse files
author
Ivan Dlugos
committed
remote test-db before and after each test-case
1 parent 4e9446f commit eea4417

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

tests/test_basics.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,28 @@
55
import objectbox.version
66
from tests.model import TestEntity
77

8+
db_name = 'testdata'
9+
10+
11+
def remove_test_db():
12+
if os.path.exists(db_name):
13+
shutil.rmtree(db_name)
14+
15+
# cleanup before and after each testcase
16+
@pytest.fixture(autouse=True)
17+
def run_around_tests():
18+
remove_test_db()
19+
yield # run the test function
20+
remove_test_db()
21+
822

923
def test_version():
1024
info = objectbox.version.version_info()
1125
assert len(info) > 10
1226

1327

1428
def load_empty_test_objectbox() -> objectbox.ObjectBox:
15-
db_name = 'testdata'
16-
17-
if os.path.exists(db_name):
18-
shutil.rmtree(db_name)
29+
remove_test_db()
1930

2031
model = objectbox.Model()
2132
from objectbox.model import IdUid

0 commit comments

Comments
 (0)