home
·
contact
·
privacy
projects
/
plomtask
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
81e1ac9
)
Avoid race condition of test databases created with same timestamp.
author
Christian Heller
<c.heller@plomlompom.de>
Fri, 14 Jun 2024 12:27:57 +0000
(14:27 +0200)
committer
Christian Heller
<c.heller@plomlompom.de>
Fri, 14 Jun 2024 12:27:57 +0000
(14:27 +0200)
tests/utils.py
patch
|
blob
|
history
diff --git
a/tests/utils.py
b/tests/utils.py
index 6f44f611b487f139536822b6340fae5f5ddcf5d5..6581c61a1546e952c08b2669d28efdc0e27a06ee 100644
(file)
--- a/
tests/utils.py
+++ b/
tests/utils.py
@@
-3,7
+3,7
@@
from unittest import TestCase
from threading import Thread
from http.client import HTTPConnection
from urllib.parse import urlencode
from threading import Thread
from http.client import HTTPConnection
from urllib.parse import urlencode
-from
datetime import datetime
+from
uuid import uuid4
from os import remove as remove_file
from typing import Mapping, Any
from plomtask.db import DatabaseFile, DatabaseConnection
from os import remove as remove_file
from typing import Mapping, Any
from plomtask.db import DatabaseFile, DatabaseConnection
@@
-53,8
+53,7
@@
class TestCaseWithDB(TestCase):
Process.empty_cache()
ProcessStep.empty_cache()
Todo.empty_cache()
Process.empty_cache()
ProcessStep.empty_cache()
Todo.empty_cache()
- timestamp = datetime.now().timestamp()
- self.db_file = DatabaseFile.create_at(f'test_db:{timestamp}')
+ self.db_file = DatabaseFile.create_at(f'test_db:{uuid4()}')
self.db_conn = DatabaseConnection(self.db_file)
def tearDown(self) -> None:
self.db_conn = DatabaseConnection(self.db_file)
def tearDown(self) -> None: