File tree Expand file tree Collapse file tree 2 files changed +1
-28
lines changed Expand file tree Collapse file tree 2 files changed +1
-28
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ Changelog
10
10
- #29: Fix issues with later versions of mysql where ``mysql_defaults_file ``
11
11
fixture would prevent startup of mysql.
12
12
- Fixed issue in test suite where mysql fixture was not tested.
13
+ - Removed ``pytest_services.locks.lock_file ``.
13
14
14
15
1.3.1
15
16
-----
Original file line number Diff line number Diff line change 1
1
"""Fixtures for supporting a distributed test run."""
2
2
import contextlib
3
- import errno
4
- import fcntl
5
3
import json
6
4
import os
7
5
import socket
12
10
marker = object ()
13
11
14
12
15
- def lock_file (filename , content , operation ):
16
- """Lock given file.
17
-
18
- :param filename: full path to the lockfile
19
- :param content: content string to write to the lockfile after successful lock
20
- :param operation: os operation to use for lock
21
- :return: file object of opened locked file. Can be used to write content to it
22
- """
23
- try :
24
- handle = os .fdopen (os .open (filename , os .O_RDWR | os .O_CREAT , 0o666 ), 'r+' )
25
- except OSError as e :
26
- if e .errno == errno .EACCES :
27
- raise Exception ('Failed to open/create file. Check permissions on containing folder' )
28
- raise
29
- fcntl .flock (handle , operation )
30
- if content :
31
- handle .write (content )
32
- handle .flush ()
33
- os .fsync (handle .fileno ())
34
- try :
35
- os .chmod (filename , 0o666 )
36
- except OSError :
37
- pass
38
- return handle
39
-
40
-
41
13
def try_remove (filename ):
42
14
try :
43
15
os .unlink (filename )
You can’t perform that action at this time.
0 commit comments