This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jaraco
Recipients jaraco, mblahay, r.david.murray, steven.daprano, tim.peters
Date 2021-01-17.03:28:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1610854099.44.0.198193759201.issue32509@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-01-17 03:28:19jaracosetrecipients: + jaraco, tim.peters, steven.daprano, r.david.murray, mblahay
2021-01-17 03:28:19jaracosetmessageid: <1610854099.44.0.198193759201.issue32509@roundup.psfhosted.org>
2021-01-17 03:28:19jaracolinkissue32509 messages
2021-01-17 03:28:18jaracocreate