classification
Title: test_distutils fails
Type: behavior Stage: resolved
Components: Distutils, Tests Versions: Python 3.7, Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Mariatta, berker.peksag, dstufft, eric.araujo, python-dev, xiang.zhang, zach.ware
Priority: normal Keywords:

Created on 2016-09-21 04:27 by xiang.zhang, last changed 2018-06-09 18:50 by zach.ware. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 7564 merged zach.ware, 2018-06-09 18:38
Messages (6)
msg277091 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2016-09-21 04:27
test_distutils consistently fails now:

./python -m test test_distutils
Run tests sequentially
0:00:00 [1/1] test_distutils
test test_distutils failed -- Traceback (most recent call last):
  File "/home/angwer/cpython/Lib/distutils/tests/test_check.py", line 122, in test_check_restructuredtext_with_syntax_highlight
    self.assertEqual(cmd._warnings, 0)
AssertionError: 1 != 0

test_distutils failed

1 test failed:
    test_distutils

Total duration: 1 sec
Tests result: FAILURE
msg277104 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2016-09-21 07:27
The reason for this failure is lack of pygments. docutils seems to require pygments when parsing code block even in doc. But docutils doesn't treat pygments as a dependency and pip install it won't pull in pygments.
msg277845 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2016-10-02 02:34
Hmm.. the test works for me on master branch

$ ./python.exe -m test test_distutils
Run tests sequentially
0:00:00 [1/1] test_distutils
1 test OK.

Total duration: 4 sec
Tests result: SUCCESS
msg277846 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-10-02 03:41
I can reproduce it with the following dependencies:

    $ pip list
    docutils (0.12)
    pip (8.1.2)
    setuptools (27.1.2)

The test was added in issue 23063. Since the purpose of the test was testing a bug in _check_rst_data(), skipping it if pygments is not available wouldn't be an ideal solution.

We probably need to do something like:

    if pygments is not None:
        self.assertEqual(len(msgs), 0)
    else:
        self.assertEqual(len(msgs), 1)
        self.assertEqual(
            str(msgs[0][1]),
            'Cannot analyze code. Pygments package not found.'
        )
msg278072 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-10-04 17:55
New changeset fa09ba71babb by Berker Peksag in branch '3.5':
Issue #28222: Don't fail if pygments is not available
https://hg.python.org/cpython/rev/fa09ba71babb

New changeset d5eefcfa3458 by Berker Peksag in branch '3.6':
Issue #28222: Merge from 3.5
https://hg.python.org/cpython/rev/d5eefcfa3458

New changeset e0c1bc2e98ed by Berker Peksag in branch 'default':
Issue #28222: Merge from 3.6
https://hg.python.org/cpython/rev/e0c1bc2e98ed
msg319171 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2018-06-09 18:50
New changeset f6645ef027762adbb159a3b6d64a15538672eaa2 by Zachary Ware in branch '2.7':
bpo-28222: Don't fail if pygments is not available (GH-7564)
https://github.com/python/cpython/commit/f6645ef027762adbb159a3b6d64a15538672eaa2
History
Date User Action Args
2018-06-09 18:50:25zach.waresetnosy: + zach.ware
messages: + msg319171
2018-06-09 18:47:47zach.waresetversions: + Python 2.7
2018-06-09 18:38:28zach.waresetpull_requests: + pull_request7196
2016-10-04 17:55:49python-devsetnosy: + python-dev
messages: + msg278072
2016-10-04 17:54:03berker.peksagsetstatus: open -> closed
resolution: fixed
stage: needs patch -> resolved
2016-10-02 03:41:30berker.peksagsetnosy: + berker.peksag

messages: + msg277846
versions: + Python 3.5, Python 3.6
2016-10-02 02:34:35Mariattasetmessages: + msg277845
2016-09-29 21:25:38Mariattasetnosy: + Mariatta
2016-09-26 19:45:26serhiy.storchakasetnosy: + eric.araujo, dstufft

components: + Distutils
stage: needs patch
2016-09-21 07:27:02xiang.zhangsetmessages: + msg277104
2016-09-21 04:27:32xiang.zhangcreate