#5976: fixed distutils test_check_environ
diff --git a/Lib/distutils/tests/test_util.py b/Lib/distutils/tests/test_util.py
index 348933e..ea7c592 100644
--- a/Lib/distutils/tests/test_util.py
+++ b/Lib/distutils/tests/test_util.py
@@ -214,12 +214,17 @@
 
         # posix without HOME
         if os.name == 'posix':  # this test won't run on windows
-            os.environ = {}
-            check_environ()
-
-            import pwd
-            self.assertEquals(os.environ['HOME'],
-                              pwd.getpwuid(os.getuid())[5])
+            old_home = os.environ.get('HOME')
+            try:
+                check_environ()
+                import pwd
+                self.assertEquals(os.environ['HOME'],
+                                  pwd.getpwuid(os.getuid())[5])
+            finally:
+                if old_home is not None:
+                    os.environ['HOME'] = old_home
+                else:
+                    del os.environ['HOME']
         else:
             check_environ()
 
diff --git a/Misc/NEWS b/Misc/NEWS
index 485920a..7c037c3 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -285,6 +285,8 @@
 Library
 -------
 
+- Issue #5976: Fixed Distutils test_check_environ.
+
 - Issue #5900: Ensure RUNPATH is added to extension modules with RPATH if GNU 
   ld is used. Original patch by Floris Bruynooghe.