Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Backport PR #26576 on branch v3.8.x (Use sys.platform over os.name) #26585

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
2 changes: 1 addition & 1 deletion lib/matplotlib/dviread.py
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ def find_tex_file(filename):
if lk:
path = lk.search(filename)
else:
if os.name == 'nt':
if sys.platform == 'win32':
# On Windows only, kpathsea can use utf-8 for cmd args and output.
# The `command_line_encoding` environment variable is set to force
# it to always use utf-8 encoding. See Matplotlib issue #11848.
Expand Down
3 changes: 2 additions & 1 deletion lib/matplotlib/tests/test_animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from pathlib import Path
import platform
import re
import shutil
import subprocess
import sys
import weakref
Expand Down Expand Up @@ -318,7 +319,7 @@ def test_cleanup_temporaries(method_name, tmpdir, anim):
assert list(Path(str(tmpdir)).iterdir()) == []


@pytest.mark.skipif(os.name != "posix", reason="requires a POSIX OS")
@pytest.mark.skipif(shutil.which("/bin/sh") is None, reason="requires a POSIX OS")
def test_failing_ffmpeg(tmpdir, monkeypatch, anim):
"""
Test that we correctly raise a CalledProcessError when ffmpeg fails.
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_backend_webagg.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def test_webagg_fallback(backend):
if backend == "nbagg":
pytest.importorskip("IPython")
env = dict(os.environ)
if os.name != "nt":
if sys.platform != "win32":
env["DISPLAY"] = ""

env["MPLBACKEND"] = backend
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_backends_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def test_cross_Qt_imports():

@pytest.mark.skipif('TF_BUILD' in os.environ,
reason="this test fails an azure for unknown reasons")
@pytest.mark.skipif(os.name == "nt", reason="Cannot send SIGINT on Windows.")
@pytest.mark.skipif(sys.platform == "win32", reason="Cannot send SIGINT on Windows.")
def test_webagg():
pytest.importorskip("tornado")
proc = subprocess.Popen(
Expand Down
6 changes: 3 additions & 3 deletions lib/matplotlib/tests/test_matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ def test_parse_to_version_info(version_str, version_tuple):
assert matplotlib._parse_to_version_info(version_str) == version_tuple


@pytest.mark.skipif(
os.name == "nt", reason="chmod() doesn't work as is on Windows")
@pytest.mark.skipif(os.name != "nt" and os.geteuid() == 0,
@pytest.mark.skipif(sys.platform == "win32",
reason="chmod() doesn't work as is on Windows")
@pytest.mark.skipif(sys.platform != "win32" and os.geteuid() == 0,
reason="chmod() doesn't work as root")
def test_tmpconfigdir_warning(tmpdir):
"""Test that a warning is emitted if a temporary configdir must be used."""
Expand Down