summaryrefslogtreecommitdiff
path: root/setuptools/_distutils/tests/support.py
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/_distutils/tests/support.py')
-rw-r--r--setuptools/_distutils/tests/support.py28
1 files changed, 3 insertions, 25 deletions
diff --git a/setuptools/_distutils/tests/support.py b/setuptools/_distutils/tests/support.py
index 5203ed19..fd4b11bf 100644
--- a/setuptools/_distutils/tests/support.py
+++ b/setuptools/_distutils/tests/support.py
@@ -5,29 +5,14 @@ import shutil
import tempfile
import sysconfig
import itertools
+import pathlib
import pytest
+from more_itertools import always_iterable
-from distutils.log import DEBUG, INFO, WARN, ERROR, FATAL
from distutils.core import Distribution
-@pytest.mark.usefixtures('distutils_logging_silencer')
-class LoggingSilencer:
- def _log(self, level, msg, args):
- if level not in (DEBUG, INFO, WARN, ERROR, FATAL):
- raise ValueError('%s wrong log level' % str(level))
- if not isinstance(msg, str):
- raise TypeError("msg should be str, not '%.200s'" % (type(msg).__name__))
- self.logs.append((level, msg, args))
-
- def get_logs(self, *levels):
- return [msg % args for level, msg, args in self.logs if level in levels]
-
- def clear_logs(self):
- self.logs = []
-
-
@pytest.mark.usefixtures('distutils_managed_tempdir')
class TempdirManager:
"""
@@ -46,16 +31,9 @@ class TempdirManager:
def write_file(self, path, content='xxx'):
"""Writes a file in the given path.
-
path can be a string or a sequence.
"""
- if isinstance(path, (list, tuple)):
- path = os.path.join(*path)
- f = open(path, 'w')
- try:
- f.write(content)
- finally:
- f.close()
+ pathlib.Path(*always_iterable(path)).write_text(content)
def create_dist(self, pkg_name='foo', **kw):
"""Will generate a test environment.