aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/snakeoil/test/mixins.py33
1 files changed, 0 insertions, 33 deletions
diff --git a/src/snakeoil/test/mixins.py b/src/snakeoil/test/mixins.py
index 422b1bde..2c8abcad 100644
--- a/src/snakeoil/test/mixins.py
+++ b/src/snakeoil/test/mixins.py
@@ -2,7 +2,6 @@ import errno
import inspect
import io
import os
-import shutil
import stat
import sys
import tempfile
@@ -11,38 +10,6 @@ from ..compatibility import IGNORED_EXCEPTIONS
from . import TestCase
-class TempDirMixin(TestCase):
-
- def setUp(self):
- self.dir = tempfile.mkdtemp()
- # force it, since sticky bits spread.
- os.chmod(self.dir, 0o700)
-
- def tearDown(self):
- # change permissions back or rmtree can't kill it
- if not os.path.exists(self.dir):
- return
- for root, dirs, _files in os.walk(self.dir):
- for directory in dirs:
- os.chmod(os.path.join(root, directory), 0o700)
- shutil.rmtree(self.dir)
-
-def tempdir_decorator(func):
- def f(self, *args, **kwargs):
- self.dir = tempfile.mkdtemp()
- try:
- os.chmod(self.dir, 0o700)
- return func(self, *args, **kwargs)
- finally:
- if os.path.exists(self.dir):
- for root, dirs, _files in os.walk(self.dir):
- for directory in dirs:
- os.chmod(os.path.join(root, directory), 0o777)
- shutil.rmtree(self.dir)
- f.__name__ = func.__name__
- return f
-
-
def mk_named_tempfile(*args, **kwds):
tmp_f = tempfile.NamedTemporaryFile(*args, **kwds)
return io.TextIOWrapper(tmp_f)