Skip to content

Make test_check consistent on test environment #354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions distutils/tests/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@

import pytest

try:
import pygments
except ImportError:
pygments = None


HERE = os.path.dirname(__file__)


Expand Down Expand Up @@ -103,7 +97,6 @@ def test_check_author_maintainer(self):
assert cmd._warnings == 0

def test_check_document(self):
pytest.importorskip('docutils')
pkg_info, dist = self.create_dist()
cmd = check(dist)

Expand All @@ -118,7 +111,6 @@ def test_check_document(self):
assert len(msgs) == 0

def test_check_restructuredtext(self):
pytest.importorskip('docutils')
# let's see if it detects broken rest in long_description
broken_rest = 'title\n===\n\ntest'
pkg_info, dist = self.create_dist(long_description=broken_rest)
Expand Down Expand Up @@ -149,9 +141,7 @@ def test_check_restructuredtext(self):
assert cmd._warnings == 0

def test_check_restructuredtext_with_syntax_highlight(self):
pytest.importorskip('docutils')
# Don't fail if there is a `code` or `code-block` directive

example_rst_docs = [
textwrap.dedent(
"""\
Expand Down Expand Up @@ -179,15 +169,9 @@ def foo():
pkg_info, dist = self.create_dist(long_description=rest_with_code)
cmd = check(dist)
cmd.check_restructuredtext()
assert cmd._warnings == 0
msgs = cmd._check_rst_data(rest_with_code)
if pygments is not None:
assert len(msgs) == 0
else:
assert len(msgs) == 1
assert (
str(msgs[0][1])
== 'Cannot analyze code. Pygments package not found.'
)
assert len(msgs) == 0

def test_check_all(self):
with pytest.raises(DistutilsSetupError):
Expand Down
5 changes: 0 additions & 5 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ disable_error_code =
misc,
has-type,

# Is only imported in a test and doesn't seem relevant.
# TODO: Should we add types-pygments or remove from the test?
[mypy-pygments.*]
ignore_missing_imports = True

# stdlib's test module is not typed on typeshed
[mypy-test.*]
ignore_missing_imports = True
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ test = [
"pytest >= 6, != 8.1.*",

# local
"pytest >= 7.4.3", # 186
"pytest >= 7.4.3", # pypa/distutils#186
"jaraco.envs>=2.4",
"jaraco.path",
"jaraco.text",
"path >= 10.6",
"docutils",
"Pygments",
"pyfakefs",
"more_itertools",

Expand Down
Loading