Skip to content

Commit 2b97cb7

Browse files
committed
Fix failing unit tests for DB file mode on Python 3.6
1 parent dd8b4e9 commit 2b97cb7

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

reframe/frontend/reporting/storage.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import os
88
import re
99
import sqlite3
10+
import sys
1011
from filelock import FileLock
1112

1213
import reframe.utility.jsonext as jsonext
@@ -87,8 +88,15 @@ def _db_connect(self, *args, **kwargs):
8788

8889
def _db_lock(self):
8990
prefix = os.path.dirname(self.__db_file)
90-
return FileLock(os.path.join(prefix, '.db.lock'),
91-
mode=self.__db_file_mode)
91+
if sys.version_info >= (3, 7):
92+
kwargs = {'mode': self.__db_file_mode}
93+
else:
94+
# Python 3.6 forces us to use an older filelock version that does
95+
# not support file modes. File modes where introduced in
96+
# filelock 3.10
97+
kwargs = {}
98+
99+
return FileLock(os.path.join(prefix, '.db.lock'), **kwargs)
92100

93101
def _db_create(self):
94102
clsname = type(self).__name__

0 commit comments

Comments
 (0)