diff options
author | Anthony Sottile <asottile@umich.edu> | 2019-08-04 14:50:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-04 14:50:12 -0700 |
commit | 82763a293af926680598a537551ad2fee771c0f9 (patch) | |
tree | fded5ff0797b415fedadc241314e518fc57f6898 /src/_pytest/pathlib.py | |
parent | 73e0bf92f7e1fc365b77ed57699c37454db6d812 (diff) | |
parent | d3e190789949016410eb930d4e1045b4c45af9d8 (diff) | |
download | pytest-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.py | 11 |
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() |