diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 3942877215f53e..8c41d9799b5fa9 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