Jason R. Coombs <jar...@jaraco.com> added the comment:
I've encountered this issue again with a different use-case. I'm attempting to add a doctest to a routine that emits the paths of the files it processes. I want to use ellipses to ignore the prefixes of the output because they're not pertinent to the test. Here's the test that might have worked: https://github.com/python/importlib_resources/commit/ca9d014e1b884ff7f8cee63a436832a3e6e809fb, but failed with: ``` _______________________________________ ERROR collecting importlib_resources/tests/update-zips.py _______________________________________ /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/doctest.py:939: in find self._find(tests, obj, name, module, source_lines, globs, {}) .tox/python/lib/python3.9/site-packages/_pytest/doctest.py:522: in _find doctest.DocTestFinder._find( # type: ignore /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/doctest.py:1001: in _find self._find(tests, val, valname, module, source_lines, .tox/python/lib/python3.9/site-packages/_pytest/doctest.py:522: in _find doctest.DocTestFinder._find( # type: ignore /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/doctest.py:989: in _find test = self._get_test(obj, name, module, globs, source_lines) /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/doctest.py:1073: in _get_test return self._parser.get_doctest(docstring, globs, name, /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/doctest.py:675: in get_doctest return DocTest(self.get_examples(string, name), globs, /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/doctest.py:689: in get_examples return [x for x in self.parse(string, name) /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/doctest.py:651: in parse self._parse_example(m, name, lineno) /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/doctest.py:709: in _parse_example self._check_prompt_blank(source_lines, indent, name, lineno) /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/doctest.py:793: in _check_prompt_blank raise ValueError('line %r of the docstring for %s ' E ValueError: line 6 of the docstring for importlib_resources.tests.update-zips.main lacks blank after ...: '.../data01/utf-16.file -> ziptestdata/utf-16.file' ``` I was able to work around the issue by injecting a newline into the output (https://github.com/python/importlib_resources/commit/b8d48d5a86a9f5bd391c18e1acb39b5697f7ca40). I notice also that in some environments that the test still fails due to the arbitrary ordering of the output, but that test does pass in some environments. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32509> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com