diff --git a/tests/i18n/test_compilation.py b/tests/i18n/test_compilation.py
index a65fcac..8bc3f51 100644
--- a/tests/i18n/test_compilation.py
+++ b/tests/i18n/test_compilation.py
@@ -5,6 +5,7 @@ import gettext as gettext_module
 import os
 import shutil
 import stat
+import tempfile
 import unittest
 from subprocess import Popen
 
@@ -31,18 +32,19 @@ class MessageCompilationTests(SimpleTestCase):
     test_dir = os.path.abspath(os.path.join(os.path.dirname(upath(__file__)), 'commands'))
 
     def setUp(self):
+        # Update test_dir to point to a temporary directory and work from there
+        self._test_dir = self.test_dir
         self._cwd = os.getcwd()
-        self.addCleanup(os.chdir, self._cwd)
+        self._tempdir = tempfile.mkdtemp()
+        self.test_dir = os.path.join(self._tempdir,
+                                     os.path.basename(self._test_dir))
+        shutil.copytree(self._test_dir, self.test_dir)
         os.chdir(self.test_dir)
 
-    def _rmrf(self, dname):
-        if os.path.commonprefix([self.test_dir, os.path.abspath(dname)]) != self.test_dir:
-            return
-        shutil.rmtree(dname)
-
-    def rmfile(self, filepath):
-        if os.path.exists(filepath):
-            os.remove(filepath)
+    def tearDown(self):
+        shutil.rmtree(self._tempdir)
+        self.test_dir = self._test_dir
+        os.chdir(self._cwd)
 
 
 class PoFileTests(MessageCompilationTests):
@@ -76,10 +78,6 @@ class PoFileContentsTests(MessageCompilationTests):
     LOCALE = 'fr'
     MO_FILE = 'locale/%s/LC_MESSAGES/django.mo' % LOCALE
 
-    def setUp(self):
-        super(PoFileContentsTests, self).setUp()
-        self.addCleanup(os.unlink, os.path.join(self.test_dir, self.MO_FILE))
-
     def test_percent_symbol_in_po_file(self):
         call_command('compilemessages', locale=[self.LOCALE], stdout=StringIO())
         self.assertTrue(os.path.exists(self.MO_FILE))
@@ -95,8 +93,6 @@ class MultipleLocaleCompilationTests(MessageCompilationTests):
         localedir = os.path.join(self.test_dir, 'locale')
         self.MO_FILE_HR = os.path.join(localedir, 'hr/LC_MESSAGES/django.mo')
         self.MO_FILE_FR = os.path.join(localedir, 'fr/LC_MESSAGES/django.mo')
-        self.addCleanup(self.rmfile, os.path.join(localedir, self.MO_FILE_HR))
-        self.addCleanup(self.rmfile, os.path.join(localedir, self.MO_FILE_FR))
 
     def test_one_locale(self):
         with override_settings(LOCALE_PATHS=[os.path.join(self.test_dir, 'locale')]):
@@ -122,7 +118,6 @@ class ExcludedLocaleCompilationTests(MessageCompilationTests):
         super(ExcludedLocaleCompilationTests, self).setUp()
 
         shutil.copytree('canned_locale', 'locale')
-        self.addCleanup(self._rmrf, os.path.join(self.test_dir, 'locale'))
 
     def test_command_help(self):
         with captured_stdout(), captured_stderr():
@@ -161,14 +156,12 @@ class CompilationErrorHandling(MessageCompilationTests):
     def test_error_reported_by_msgfmt(self):
         # po file contains wrong po formatting.
         mo_file = 'locale/ja/LC_MESSAGES/django.mo'
-        self.addCleanup(self.rmfile, os.path.join(self.test_dir, mo_file))
         with self.assertRaises(CommandError):
             call_command('compilemessages', locale=['ja'], verbosity=0)
 
     def test_msgfmt_error_including_non_ascii(self):
         # po file contains invalid msgstr content (triggers non-ascii error content).
         mo_file = 'locale/ko/LC_MESSAGES/django.mo'
-        self.addCleanup(self.rmfile, os.path.join(self.test_dir, mo_file))
         # Make sure the output of msgfmt is unaffected by the current locale.
         env = os.environ.copy()
         env.update({str('LANG'): str('C')})
@@ -192,11 +185,6 @@ class ProjectAndAppTests(MessageCompilationTests):
     PROJECT_MO_FILE = 'locale/%s/LC_MESSAGES/django.mo' % LOCALE
     APP_MO_FILE = 'app_with_locale/locale/%s/LC_MESSAGES/django.mo' % LOCALE
 
-    def setUp(self):
-        super(ProjectAndAppTests, self).setUp()
-        self.addCleanup(self.rmfile, os.path.join(self.test_dir, self.PROJECT_MO_FILE))
-        self.addCleanup(self.rmfile, os.path.join(self.test_dir, self.APP_MO_FILE))
-
 
 class FuzzyTranslationTest(ProjectAndAppTests):
 
