FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-40055: distutils tests now disable docutils import by vstinner · Pull Request #19139 · python/cpython · GitHub

Repository navigation

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (3) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
6 changes: 6 additions & 0 deletions Lib/distutils/tests/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
from test.support import run_unittest


# bpo-40055: Prevent docutils from being imported to avoid depending on
# docutils. Import docutils can have side effects. For example, docutils
# imports pkg_resources which changes warnings filters.
sys.modules['docutils'] = None


here = os.path.dirname(__file__) or os.curdir


Expand Down
1 change: 1 addition & 0 deletions Lib/distutils/tests/test_check.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import unittest
from test.support import run_unittest

# bpo-40055: distutils.tests prevents docutils from being imported
from distutils.command.check import check, HAS_DOCUTILS
from distutils.tests import support
from distutils.errors import DistutilsSetupError
Expand Down
10 changes: 4 additions & 6 deletions Lib/distutils/tests/test_register.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@

from distutils.tests.test_config import BasePyPIRCCommandTestCase

try:
import docutils
except ImportError:
docutils = None
# bpo-40055: distutils.tests prevents docutils from being imported
from distutils.command.check import HAS_DOCUTILS

PYPIRC_NOPASSWORD = """\
[distutils]
Expand Down Expand Up @@ -204,7 +202,7 @@ def test_password_reset(self):
self.assertEqual(headers['Content-length'], '290')
self.assertIn(b'tarek', req.data)

@unittest.skipUnless(docutils is not None, 'needs docutils')
@unittest.skipUnless(HAS_DOCUTILS, 'needs docutils')
def test_strict(self):
# testing the script option
# when on, the register command stops if
Expand Down Expand Up @@ -270,7 +268,7 @@ def test_strict(self):
finally:
del register_module.input

@unittest.skipUnless(docutils is not None, 'needs docutils')
@unittest.skipUnless(HAS_DOCUTILS, 'needs docutils')
def test_register_invalid_long_description(self):
description = ':funkie:`str`' # mimic Sphinx-specific markup
metadata = {'url': 'xxx', 'author': 'xxx',
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Distutils tests now prevent docutils from being imported since "import
docutils" can have side effects on tests. For example, it imports
pkg_resources which alters warnings filters.

Back | FazBrowse Home | New Git URL