[issue36597] Travis CI: doctest failure

New submission from STINNER Victor <vstinner@redhat.com>: On my https://github.com/python/cpython/pull/12770 the doctest job of Travis CI failed with: https://travis-ci.org/python/cpython/jobs/518572326 mkdir -p build Building NEWS from Misc/NEWS.d with blurb PATH=./venv/bin:$PATH sphinx-build -b doctest -d build/doctrees -D latex_elements.papersize= -q -W -j4 -W . build/doctest /home/travis/build/python/cpython/Doc/tools/extensions/pyspecific.py:274: RemovedInSphinx30Warning: env.note_versionchange() is deprecated. Please use ChangeSetDomain.note_changeset() instead. env.note_versionchange('deprecated', version[0], node, self.lineno) /home/travis/build/python/cpython/Doc/tools/extensions/pyspecific.py:274: RemovedInSphinx30Warning: env.note_versionchange() is deprecated. Please use ChangeSetDomain.note_changeset() instead. env.note_versionchange('deprecated', version[0], node, self.lineno) /home/travis/build/python/cpython/Doc/tools/extensions/pyspecific.py:274: RemovedInSphinx30Warning: env.note_versionchange() is deprecated. Please use ChangeSetDomain.note_changeset() instead. env.note_versionchange('deprecated', version[0], node, self.lineno) /home/travis/build/python/cpython/Doc/tools/extensions/pyspecific.py:274: RemovedInSphinx30Warning: env.note_versionchange() is deprecated. Please use ChangeSetDomain.note_changeset() instead. env.note_versionchange('deprecated', version[0], node, self.lineno) /home/travis/build/python/cpython/Doc/tools/extensions/pyspecific.py:274: RemovedInSphinx30Warning: env.note_versionchange() is deprecated. Please use ChangeSetDomain.note_changeset() instead. env.note_versionchange('deprecated', version[0], node, self.lineno) /home/travis/build/python/cpython/Doc/tools/extensions/pyspecific.py:274: RemovedInSphinx30Warning: env.note_versionchange() is deprecated. Please use ChangeSetDomain.note_changeset() instead. env.note_versionchange('deprecated', version[0], node, self.lineno) /home/travis/build/python/cpython/Doc/tools/extensions/pyspecific.py:274: RemovedInSphinx30Warning: env.note_versionchange() is deprecated. Please use ChangeSetDomain.note_changeset() instead. env.note_versionchange('deprecated', version[0], node, self.lineno) /home/travis/build/python/cpython/Doc/tools/extensions/pyspecific.py:274: RemovedInSphinx30Warning: env.note_versionchange() is deprecated. Please use ChangeSetDomain.note_changeset() instead. env.note_versionchange('deprecated', version[0], node, self.lineno) Warning, treated as error: ********************************************************************** File "library/unittest.mock-examples.rst", line ?, in default Failed example: m.one().two().three() Expected: <MagicMock name='mock.one().two().three()' id='...'> Got: obj dead or exiting <MagicMock name='mock.one().two().three()' id='140222049958880'> Makefile:44: recipe for target 'build' failed make[1]: *** [build] Error 2 -- I can reproduce this issue on Linux with: $ cd Doc $ make venv $ PATH=./venv/bin:$PATH sphinx-build -b doctest -d build/doctrees -D latex_elements.papersize= -q -W -j4 -W . build/doctest I get random errors: Warning, treated as error: ********************************************************************** File "library/datetime.rst", line 686, in default Failed example: d.strftime("%A %d. %B %Y") Expected: 'Monday 11. March 2002' Got: 'lundi 11. mars 2002' Warning, treated as error: ********************************************************************** File "library/collections.rst", line 914, in default Failed example: p._asdict() Expected: {'x': 11, 'y': 22} Got: OrderedDict([('x', 11), ('y', 22)]) Warning, treated as error: ********************************************************************** File "library/unittest.mock.rst", line ?, in default Failed example: mock.call_args.args Expected: (3, 4) Got: args The virtual environment uses Sphinx 2.0.1. Can it be a change in Sphinx 2 default configuration? ---------- assignee: docs@python components: Documentation messages: 339919 nosy: docs@python, vstinner priority: normal severity: normal status: open title: Travis CI: doctest failure versions: Python 3.8 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

Change by Karthikeyan Singaravelan <tir.karthi@gmail.com>: ---------- nosy: +mdk _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

STINNER Victor <vstinner@redhat.com> added the comment: Well, same problem with Sphinx 1.8.5. No idea why the job started to fail. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

Change by STINNER Victor <vstinner@redhat.com>: ---------- keywords: +patch pull_requests: +12702 stage: -> patch review _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

On Thu, Apr 11, 2019 at 11:49 AM STINNER Victor <report@bugs.python.org> wrote:
File "library/unittest.mock-examples.rst", line ?, in default Failed example: m.one().two().three() Expected: <MagicMock name='mock.one().two().three()' id='...'> Got: obj dead or exiting <MagicMock name='mock.one().two().three()' id='140222049958880'>
I'm not sure where "obj is dead or exiting" came from.
File "library/datetime.rst", line 686, in default Failed example: d.strftime("%A %d. %B %Y") Expected: 'Monday 11. March 2002' Got: 'lundi 11. mars 2002'
It seems it is caused by non English locale.
File "library/collections.rst", line 914, in default Failed example: p._asdict() Expected: {'x': 11, 'y': 22} Got: OrderedDict([('x', 11), ('y', 22)])
You may run doctest with existing Python, not Python 3.8.
File "library/unittest.mock.rst", line ?, in default Failed example: mock.call_args.args Expected: (3, 4) Got: args
I'm not sure about this. -- Inada Naoki <songofacandy@gmail.com>

STINNER Victor <vstinner@redhat.com> added the comment:
It seems it is caused by non English locale.
Right, but why did it start to fail since yesterday?
You may run doctest with existing Python, not Python 3.8.
I used the command from the .travis.yml job: "... make -C Doc/ PYTHON=../python "...". It explicitly picks the Python it just compiled. Why would we like to check the doctests using a random Python version, whereas it's Python 3.8 documentation? ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

Inada Naoki <songofacandy@gmail.com> added the comment:
It seems it is caused by non English locale.
Right, but why did it start to fail since yesterday?
Is it an error start to fail since yesterday? As far as reading your first report, this is happen only in your local environment.
You may run doctest with existing Python, not Python 3.8.
I used the command from the .travis.yml job: "... make -C Doc/ PYTHON=../python "...". It explicitly picks the Python it just compiled.
This error is in your environment too. Maybe you re-used old venv?
Why would we like to check the doctests using a random Python version, whereas it's Python 3.8 documentation?
Because it "doctest". Python behavior (repr) can be changed. Python 3.8 replaces some OrderedDict usage with regular dict. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

STINNER Victor <vstinner@redhat.com> added the comment: 8 hours ago, the job still passed at the top of the the master branch (commit a9bd8925c7fa50dd3cfab125b824ec192133ef49): https://travis-ci.org/python/cpython/jobs/518281237 "Successfully installed Jinja2-2.10.1 MarkupSafe-1.1.1 Pygments-2.3.1 Sphinx-2.0.1 alabaster-0.7.12 babel-2.6.0 blurb-1.0.7 certifi-2019.3.9 chardet-3.0.4 docutils-0.14 idna-2.8 imagesize-1.1.0 packaging-19.0 pyparsing-2.4.0 python-docs-theme-2018.7 pytz-2019.1 requests-2.21.0 six-1.12.0 snowballstemmer-1.2.1 sphinxcontrib-applehelp-1.0.1 sphinxcontrib-devhelp-1.0.1 sphinxcontrib-htmlhelp-1.0.1 sphinxcontrib-jsmath-1.0.1 sphinxcontrib-qthelp-1.0.2 sphinxcontrib-serializinghtml-1.1.3 urllib3-1.24.1" ... PATH=./venv/bin:$PATH sphinx-build -b doctest -d build/doctrees -D latex_elements.papersize= -q -W -j4 -W . build/doctest ... The command "xvfb-run make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W -j4" doctest" exited with 0. --- 6 hours ago, it failed: https://travis-ci.org/python/cpython/jobs/518572326 Successfully installed Jinja2-2.10.1 MarkupSafe-1.1.1 Pygments-2.3.1 Sphinx-2.0.1 alabaster-0.7.12 babel-2.6.0 blurb-1.0.7 certifi-2019.3.9 chardet-3.0.4 docutils-0.14 idna-2.8 imagesize-1.1.0 packaging-19.0 pyparsing-2.4.0 python-docs-theme-2018.7 pytz-2019.1 requests-2.21.0 six-1.12.0 snowballstemmer-1.2.1 sphinxcontrib-applehelp-1.0.1 sphinxcontrib-devhelp-1.0.1 sphinxcontrib-htmlhelp-1.0.1 sphinxcontrib-jsmath-1.0.1 sphinxcontrib-qthelp-1.0.2 sphinxcontrib-serializinghtml-1.1.3 urllib3-1.24.1 Warning, treated as error: (...) -- In the 2 builds, pip installed the the same Python modules versions. I compared the raw logs of the 2 builds. In short, they are the same. Maybe the job already failed previously, but only randomly? ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

STINNER Victor <vstinner@redhat.com> added the comment: New changeset adff01e81d291c698581eadd693caa43ae5c78ac by Victor Stinner in branch 'master': bpo-36597: Disable Travis CI doctest job (GH-12775) https://github.com/python/cpython/commit/adff01e81d291c698581eadd693caa43ae5... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

STINNER Victor <vstinner@redhat.com> added the comment: I mark this issue as a release blocker to not forget it. I disabled the Travis CI doctest job to repair the CI, but we have to investigate why it started to fail yesterday. ---------- nosy: +lukasz.langa priority: normal -> release blocker _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

STINNER Victor <vstinner@redhat.com> added the comment:
As far as reading your first report, this is happen only in your local environment.
See the beginning of my first message, the doctest prevents me to merge a PR. But I tested on the master branch without my change, and I get the same issue locally, and the issues seems to be unrelated to my change. """ On my https://github.com/python/cpython/pull/12770 the doctest job of Travis CI failed with: https://travis-ci.org/python/cpython/jobs/518572326 """ ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

Karthikeyan Singaravelan <tir.karthi@gmail.com> added the comment: "Object dead or exiting" is a less frequent random error with doctest. I am not sure from where it occurs but occurs for different tests at different times and is overlooked in Travis since the next runs are fine. Sample old builds : https://travis-ci.org/python/cpython/jobs/517606752 https://travis-ci.org/python/cpython/jobs/510847596 ---------- nosy: +xtreak _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

Inada Naoki <songofacandy@gmail.com> added the comment:
See the beginning of my first message, the doctest prevents me to merge a PR.
You did not show travis build link which failed other than "obj dead or exiting" error. Don't all other errors happened only on your environment? If no, please link to travis build link. As far as I can confirm now, only "obj dead or exiting" error is problem in Travis.
But I tested on the master branch without my change, and I get the same issue locally, and the issues seems to be unrelated to my change.
I suspect your environment (locale and venv used to run doctest), not your changes.
""" On my https://github.com/python/cpython/pull/12770 the doctest job of Travis CI failed with:
Only "obj dead or exiting" happened in the job. ---------- nosy: -xtreak _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

Inada Naoki <songofacandy@gmail.com> added the comment: https://github.com/python/cpython/blob/master/Doc/library/weakref.rst#finali... >>> obj = Object() >>> weakref.finalize(obj, print, "obj dead or exiting") #doctest:+ELLIPSIS <finalize object at ...; for 'Object' at ...> >>> exit() #doctest:+SKIP obj dead or exiting Note that "#doctest:+SKIP". print("obj dead or exiting") is called after weakref test. This may caused random doctest fail. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

Change by Inada Naoki <songofacandy@gmail.com>: ---------- pull_requests: +12703 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

STINNER Victor <vstinner@redhat.com> added the comment:
You did not show travis build link which failed other than "obj dead or exiting" error.
Really? When I click on https://travis-ci.org/python/cpython/jobs/518572326 (the second link of my first message), I still see: """ Warning, treated as error: ********************************************************************** File "library/unittest.mock-examples.rst", line ?, in default Failed example: m.one().two().three() Expected: <MagicMock name='mock.one().two().three()' id='...'> Got: obj dead or exiting <MagicMock name='mock.one().two().three()' id='140222049958880'> Makefile:44: recipe for target 'build' failed make[1]: *** [build] Error 2 """ This error comes from Travis CI.
I suspect your environment (locale and venv used to run doctest), not your changes.
You can ignore the date failure, but how is the following error related to my environment? """ File "library/collections.rst", line 914, in default Failed example: p._asdict() Expected: {'x': 11, 'y': 22} Got: OrderedDict([('x', 11), ('y', 22)]) """ I used the same commands than .travis.yml. If we are unable to get the same environment than in Travis CI, we have a big problem. I agree to ignore the locale, this is a lower priority issue. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

Inada Naoki <songofacandy@gmail.com> added the comment: On Thu, Apr 11, 2019 at 5:19 PM STINNER Victor <report@bugs.python.org> wrote:
Really? When I click on https://travis-ci.org/python/cpython/jobs/518572326 (the second link of my first message), I still see:
""" Warning, treated as error: ********************************************************************** File "library/unittest.mock-examples.rst", line ?, in default Failed example: m.one().two().three() Expected: <MagicMock name='mock.one().two().three()' id='...'> Got: obj dead or exiting <MagicMock name='mock.one().two().three()' id='140222049958880'> Makefile:44: recipe for target 'build' failed make[1]: *** [build] Error 2 """
This error comes from Travis CI.
It is "obj dead or exiting" error. I didn't say it is caused by your environment. It is only error happened in Travis.
I suspect your environment (locale and venv used to run doctest), not your changes.
You can ignore the date failure, but how is the following error related to my environment?
""" File "library/collections.rst", line 914, in default Failed example: p._asdict() Expected: {'x': 11, 'y': 22} Got: OrderedDict([('x', 11), ('y', 22)])
namedtuple._asdict() changed to return dict instead of OrderedDict. If your venv is created before the change, this error can be happened. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

Inada Naoki <songofacandy@gmail.com> added the comment: I think PR-12776 fixed "obj dead or exiting" error. https://travis-ci.org/python/cpython/jobs/518656385 ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

Inada Naoki <songofacandy@gmail.com> added the comment: New changeset 57b1a2862a99677f09614e9e456d36aae9ddd87c by Inada Naoki in branch 'master': bpo-36597: fix random doctest failure (GH-12776) https://github.com/python/cpython/commit/57b1a2862a99677f09614e9e456d36aae9d... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

Change by Inada Naoki <songofacandy@gmail.com>: ---------- pull_requests: +12705 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

Change by Inada Naoki <songofacandy@gmail.com>: ---------- pull_requests: +12706 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

Inada Naoki <songofacandy@gmail.com> added the comment: New changeset b3c92c6ae923ffb2b9ac5f80b28ecd689de48662 by Inada Naoki in branch 'master': bpo-36597: fix weakref example code (GH-12779) https://github.com/python/cpython/commit/b3c92c6ae923ffb2b9ac5f80b28ecd689de... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

Inada Naoki <songofacandy@gmail.com> added the comment: New changeset ac31da8f3710f9f9b8dbb4c36b2108fb1e5b4a48 by Inada Naoki in branch '3.7': bpo-36597: fix random doctest failure (GH-12778) https://github.com/python/cpython/commit/ac31da8f3710f9f9b8dbb4c36b2108fb1e5... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________

Change by Inada Naoki <songofacandy@gmail.com>: ---------- resolution: -> fixed stage: patch review -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue36597> _______________________________________
participants (4)
-
Inada Naoki
-
Inada Naoki
-
Karthikeyan Singaravelan
-
STINNER Victor