[docutils:bugs] #471 0.20 fails tests on pypy3

"Michał Górny" via Docutils-develop <[email protected]>
Newsgroups gmane.text.docutils.devel
Message-ID </p/docutils/bugs/471/0f5a27ce36f2bff7f1597149b270ac11a8ffd697.bugs@docutils.p.sourceforge.net>
> It is a "false alarm", the different output should not trigger a test failure.

Indeed. I'm not sure if the different output from PyPy3 is actually intentional but I don't think it should cause a test failure anyway.

> How do you start the test with PyPy3?

(using docutils-0.20 unpacked from sdist)

```
pypy3 -m venv .venvpypy
. .venvpypy/bin/activate
pip install .
python test/alltests.py
```

> Does the same error show if you run "docutils/test/alltests.py" with Python 3.9.16?

No. All tests pass then. I think the `PosixPath(…)` part of exception is PyPy-specific:

```
$ python3.9 -c 'from pathlib import Path; Path("foo").read_text()'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.9/pathlib.py", line 1266, in read_text
    with self.open(mode='r', encoding=encoding, errors=errors) as f:
  File "/usr/lib/python3.9/pathlib.py", line 1252, in open
    return io.open(self, mode, buffering, encoding, errors, newline,
  File "/usr/lib/python3.9/pathlib.py", line 1120, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: 'foo'
$ pypy3.9 -c 'from pathlib import Path; Path("foo").read_text()'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/pypy3.9/pathlib.py", line 1266, in read_text
    with self.open(mode='r', encoding=encoding, errors=errors) as f:
  File "/usr/lib/pypy3.9/pathlib.py", line 1252, in open
    return io.open(self, mode, buffering, encoding, errors, newline,
  File "/usr/lib/pypy3.9/pathlib.py", line 1120, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: PosixPath('foo')
```


---

**[bugs:#471] 0.20 fails tests on pypy3**

**Status:** open
**Created:** Wed May 10, 2023 02:53 AM UTC by Michał Górny
**Last Updated:** Wed May 10, 2023 07:26 AM UTC
**Owner:** nobody


When running the test suite of the 0.20 release on PyPy3, I get the following test failure:

```
Testing Docutils 0.20 with Python 3.9.16 on 2023-05-10 at 04:44:04
OS: Linux 6.2.14-gentoo-dist #1 SMP PREEMPT_DYNAMIC Mon May  1 15:03:02 -00 2023 (linux, Linux-6.2.14-gentoo-dist-x86_64-AMD_Ryzen_5_3600_6-Core_Processor-with-glibc2.37)
Working directory: /tmp/portage/dev-python/docutils-0.20/work/docutils-0.20/test
Docutils package: /tmp/portage/dev-python/docutils-0.20/work/docutils-0.20/docutils
.....................................................................s................................................................................................................................................................................................................s..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................E.............................................
======================================================================
FAIL: test_embed_embed_stylesheet (test_writers.test_latex2e.WriterPublishTestCase) (id="samples_embed_stylesheet['two-styles'][0]")
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/portage/dev-python/docutils-0.20/work/docutils-0.20/test/test_writers/test_latex2e.py", line 151, in test_embed_embed_stylesheet
    self.assertEqual(output, expected)
AssertionError: "\\do[452 chars]ory: PosixPath('data/spam.sty')\n% embedded st[439 chars]t}\n" != "\\do[452 chars]ory: 'data/spam.sty'\n% embedded stylesheet: d[428 chars]t}\n"
  \documentclass[a4paper]{article}
  % generated by Docutils <https://docutils.sourceforge.io/>
  \usepackage{cmap} % fix search and cut-and-paste in Acrobat
  \usepackage{ifthen}
  \usepackage[T1]{fontenc}
  
  %%% Custom LaTeX preamble
  % PDF Standard Fonts
  \usepackage{mathptmx} % Times
  \usepackage[scaled=.90]{helvet}
  \usepackage{courier}
  
  %%% User specified packages and stylesheets
  % Cannot embed stylesheet:
- %  [Errno 2] No such file or directory: PosixPath('data/spam.sty')
?                                         ----------               -
+ %  [Errno 2] No such file or directory: 'data/spam.sty'
  % embedded stylesheet: data/ham.tex
  \newcommand{\ham}{wonderful ham}
  
  
  %%% Fallback definitions for Docutils-specific commands
  
  % hyperlinks:
  \ifthenelse{\isundefined{\hypersetup}}{
    \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
    \usepackage{bookmark}
    \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
  }{}
  
  %%% Body
  \begin{document}
  
  two stylesheets embedded in the header
  
  \end{document}


----------------------------------------------------------------------
Ran 1636 tests in 14.868s

FAILED (failures=1, skipped=2)
Elapsed time: 15.745 seconds
```


---

Sent from sourceforge.net because [email protected] is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.