diff --git a/tests/server/test_server.py b/tests/server/test_server.py index ed5e5fc82..44a3c82e3 100644 --- a/tests/server/test_server.py +++ b/tests/server/test_server.py @@ -8,10 +8,10 @@ import json import logging import select +import time import unittest import uuid from unittest.mock import MagicMock -import time import aepsych.server as server import aepsych.utils_logging as utils_logging @@ -64,7 +64,7 @@ def tearDown(self): self.s.cleanup() # sleep to ensure db is closed - time.sleep(0.1) + time.sleep(0.2) # cleanup the db if self.s.db is not None: diff --git a/tests/test_db.py b/tests/test_db.py index 460a1f5cf..e2a2a842f 100644 --- a/tests/test_db.py +++ b/tests/test_db.py @@ -8,6 +8,7 @@ import json import os import shutil +import time import unittest import uuid from configparser import DuplicateOptionError @@ -26,6 +27,7 @@ def setUp(self): self._database = db.Database(db_path=self._dbname) def tearDown(self): + time.sleep(0.1) self._database.delete_db() def test_db_create(self): @@ -129,6 +131,9 @@ def test_update_db(self): shutil.copy(str(db_path), str(dst_db_path)) self.assertTrue(dst_db_path.is_file()) + # add sleep to ensure file is ready + time.sleep(0.1) + # open the new db test_database = db.Database(db_path=dst_db_path.as_posix()) @@ -170,6 +175,9 @@ def test_update_db_with_raw_data_tables(self): shutil.copy(str(db_path), str(dst_db_path)) self.assertTrue(dst_db_path.is_file()) + # sleep to ensure db is ready + time.sleep(0.1) + # open the new db test_database = db.Database(db_path=dst_db_path.as_posix())