summaryrefslogtreecommitdiff
path: root/src/_pytest/pathlib.py
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2019-08-04 14:50:12 -0700
committerGitHub <noreply@github.com>2019-08-04 14:50:12 -0700
commit82763a293af926680598a537551ad2fee771c0f9 (patch)
treefded5ff0797b415fedadc241314e518fc57f6898 /src/_pytest/pathlib.py
parent73e0bf92f7e1fc365b77ed57699c37454db6d812 (diff)
parentd3e190789949016410eb930d4e1045b4c45af9d8 (diff)
downloadpytest-82763a293af926680598a537551ad2fee771c0f9.tar.gz
Merge pull request #5684 from nicoddemus/errno-nomore
Use OSError subclasses instead of handling errno
Diffstat (limited to 'src/_pytest/pathlib.py')
-rw-r--r--src/_pytest/pathlib.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/_pytest/pathlib.py b/src/_pytest/pathlib.py
index 1c0c45b14..19f9c062f 100644
--- a/src/_pytest/pathlib.py
+++ b/src/_pytest/pathlib.py
@@ -1,5 +1,4 @@
import atexit
-import errno
import fnmatch
import itertools
import operator
@@ -163,14 +162,8 @@ def create_cleanup_lock(p):
lock_path = get_lock_path(p)
try:
fd = os.open(str(lock_path), os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o644)
- except OSError as e:
- if e.errno == errno.EEXIST:
- raise EnvironmentError(
- "cannot create lockfile in {path}".format(path=p)
- ) from e
-
- else:
- raise
+ except FileExistsError as e:
+ raise EnvironmentError("cannot create lockfile in {path}".format(path=p)) from e
else:
pid = os.getpid()
spid = str(pid).encode()