diff options
author | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2023-05-11 15:50:42 +0000 |
---|---|---|
committer | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2023-05-11 15:50:42 +0000 |
commit | b1a5fb0ec2431e34a186de6a0d1dc76159860fa4 (patch) | |
tree | 228b6ef2834edc8d05868ecca608f43164fd6ea4 | |
parent | 704c9ed3453594e7b1c7cb948bf34a830d2234ee (diff) | |
download | docutils-b1a5fb0ec2431e34a186de6a0d1dc76159860fa4.tar.gz |
Fix false alarm when testing with pypy 3.9.
Work around non-standard error message from pypy 3.9.
Fixes [bugs:#471].
git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9384 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rwxr-xr-x | docutils/test/test_writers/test_latex2e.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/docutils/test/test_writers/test_latex2e.py b/docutils/test/test_writers/test_latex2e.py index 91c116b7e..74b1f9d1a 100755 --- a/docutils/test/test_writers/test_latex2e.py +++ b/docutils/test/test_writers/test_latex2e.py @@ -22,8 +22,14 @@ from docutils.core import publish_string # DATA_ROOT is ./test/data from the docutils root DATA_ROOT = Path(__file__).resolve().parents[1] / 'data' -spam = os.path.relpath(DATA_ROOT/'spam').replace('\\', '/') + ham = os.path.relpath(DATA_ROOT/'ham.tex').replace('\\', '/') +spam = os.path.relpath(DATA_ROOT/'spam').replace('\\', '/') +# workaround for PyPy (cf. https://sourceforge.net/p/docutils/bugs/471/) +if sys.implementation.name == "pypy" and sys.version_info < (3, 10): + spampath = f"PosixPath('{spam}.sty')" +else: + spampath = f"'{spam}.sty'" class WriterPublishTestCase(unittest.TestCase): @@ -1227,10 +1233,11 @@ two stylesheet links in the header samples_stylesheet_embed['two-styles'] = [ ["""two stylesheets embedded in the header""", head_template.substitute(dict(parts, -stylesheet=r"""% Cannot embed stylesheet: -% [Errno 2] No such file or directory: '""" + spam + r""".sty' -% embedded stylesheet: """ + ham + r""" -\newcommand{\ham}{wonderful ham} +stylesheet=f"""\ +% Cannot embed stylesheet: +% [Errno 2] No such file or directory: {spampath} +% embedded stylesheet: {ham} +\\newcommand{{\\ham}}{{wonderful ham}} """)) + r""" two stylesheets embedded in the header |