Issue #15765: Fix quirky NetBSD getcwd() behaviour.

This is done by extending a previous fix for issue #9185 that was made for
Solaris and OpenBSD to NetBSD as well.
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 755a81c..2eba770 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -405,8 +405,16 @@
                             _create_and_do_getcwd(dirname, current_path_length + len(dirname) + 1)
                     except OSError as e:
                         expected_errno = errno.ENAMETOOLONG
-                        if 'sunos' in sys.platform or 'openbsd' in sys.platform:
-                            expected_errno = errno.ERANGE # Issue 9185
+                        # The following platforms have quirky getcwd()
+                        # behaviour -- see issue 9185 and 15765 for
+                        # more information.
+                        quirky_platform = (
+                            'sunos' in sys.platform or
+                            'netbsd' in sys.platform or
+                            'openbsd' in sys.platform
+                        )
+                        if quirky_platform:
+                            expected_errno = errno.ERANGE
                         self.assertEqual(e.errno, expected_errno)
                     finally:
                         os.chdir('..')