diff options
author | shimizukawa <shimizukawa@gmail.com> | 2017-01-05 23:43:16 +0900 |
---|---|---|
committer | shimizukawa <shimizukawa@gmail.com> | 2017-01-05 23:43:16 +0900 |
commit | 380dd23d9f1a1263a92076e2c2daa97663fa6d5c (patch) | |
tree | 5572c4f82b0baa39f38d07f4ee39db15431f487f | |
parent | ad6d731ecf780457bd3d6d2cf59832c083d63bfc (diff) | |
download | sphinx-git-380dd23d9f1a1263a92076e2c2daa97663fa6d5c.tar.gz |
pytest: remove repr_as testing feature that avoids long annoying log for test generator feature on nose. In contrast, pytest does not produce such output. So repr_as is not needed anymore. refs #1785
-rwxr-xr-x | tests/path.py | 24 | ||||
-rw-r--r-- | tests/test_intl.py | 4 | ||||
-rw-r--r-- | tests/util.py | 2 |
3 files changed, 5 insertions, 25 deletions
diff --git a/tests/path.py b/tests/path.py index 0d6892776..3c574f0c8 100755 --- a/tests/path.py +++ b/tests/path.py @@ -12,7 +12,7 @@ import sys import shutil from io import open -from six import PY2, text_type, binary_type +from six import PY2, text_type FILESYSTEMENCODING = sys.getfilesystemencoding() or sys.getdefaultencoding() @@ -144,9 +144,7 @@ class path(text_type): """ mode = 'rU' if PY2 else 'r' with open(self, mode=mode, encoding=encoding, **kwargs) as f: - text = f.read() - contents = repr_as(text, '<%s contents: %r>' % (self.basename(), text)) - return contents + return f.read() def bytes(self): """ @@ -201,21 +199,3 @@ class path(text_type): def __repr__(self): return '%s(%s)' % (self.__class__.__name__, text_type.__repr__(self)) - - -# Lives here only to avoid circular references; use it from util.py! -class _repr_text(text_type): - def __repr__(self): - return self._repr - - -class _repr_bin(binary_type): - def __repr__(self): - return self._repr - - -def repr_as(string, repr_): - wrapper = _repr_text if isinstance(string, text_type) else _repr_bin - proxy = wrapper(string) - proxy._repr = repr_ - return proxy diff --git a/tests/test_intl.py b/tests/test_intl.py index f92f44cf4..9fe5a21eb 100644 --- a/tests/test_intl.py +++ b/tests/test_intl.py @@ -22,7 +22,7 @@ from six import string_types from util import tempdir, rootdir, path, gen_with_app, with_app, SkipTest, \ assert_re_search, assert_not_re_search, assert_in, assert_not_in, \ - assert_startswith, assert_node, repr_as, etree_parse, assert_equal + assert_startswith, assert_node, etree_parse, assert_equal root = tempdir / 'test-intl' @@ -930,4 +930,4 @@ def test_image_glob_intl_using_figure_language_filename(app, status, warning): def getwarning(warnings): - return repr_as(warnings.getvalue().replace(os.sep, '/'), '<warnings>') + return warnings.getvalue().replace(os.sep, '/') diff --git a/tests/util.py b/tests/util.py index de158cc7f..8f2d1ff9a 100644 --- a/tests/util.py +++ b/tests/util.py @@ -28,7 +28,7 @@ from sphinx.ext.autodoc import AutoDirective from sphinx.pycode import ModuleAnalyzer from sphinx.deprecation import RemovedInSphinx17Warning -from path import path, repr_as # NOQA +from path import path __all__ = [ |