Skip to content

Commit

Permalink
Fix failing unit tests for DB file mode on Python 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarak committed Sep 17, 2024
1 parent dd8b4e9 commit 2b97cb7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions reframe/frontend/reporting/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import os
import re
import sqlite3
import sys
from filelock import FileLock

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

def _db_lock(self):
prefix = os.path.dirname(self.__db_file)
return FileLock(os.path.join(prefix, '.db.lock'),
mode=self.__db_file_mode)
if sys.version_info >= (3, 7):
kwargs = {'mode': self.__db_file_mode}
else:
# Python 3.6 forces us to use an older filelock version that does
# not support file modes. File modes where introduced in
# filelock 3.10
kwargs = {}

return FileLock(os.path.join(prefix, '.db.lock'), **kwargs)

def _db_create(self):
clsname = type(self).__name__
Expand Down

0 comments on commit 2b97cb7

Please sign in to comment.