From 08e544e27bcc26fd82d218ea0676da42c8b8b9f7 Mon Sep 17 00:00:00 2001
From: Antoine Pitrou <solipsis@pitrou.net>
Date: Thu, 25 Aug 2011 18:32:02 +0200
Subject: Issue #12333: fix test_distutils failures under Solaris and
 derivatives

---
 Lib/distutils/tests/support.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Lib/distutils/tests/support.py b/Lib/distutils/tests/support.py
index 7a76ca0..8452feb 100644
--- a/Lib/distutils/tests/support.py
+++ b/Lib/distutils/tests/support.py
@@ -54,9 +54,13 @@ class TempdirManager(object):
 
     def setUp(self):
         super().setUp()
+        self.old_cwd = os.getcwd()
         self.tempdirs = []
 
     def tearDown(self):
+        # Restore working dir, for Solaris and derivatives, where rmdir()
+        # on the current directory fails.
+        os.chdir(self.old_cwd)
         super().tearDown()
         while self.tempdirs:
             d = self.tempdirs.pop()
-- 
cgit v0.12

