diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index e143dc35b581c5..b50590c7a28959 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -168,7 +168,8 @@ def test_getcwd_long_path(self): # ("The filename or extension is too long") break except OSError as exc: - if exc.errno == errno.ENAMETOOLONG: + # DragonFly BSD raises EFAULT for a too long path. + if exc.errno in (errno.ENAMETOOLONG, errno.EFAULT): break else: raise