diff --git a/httpie/output/ui/man_pages.py b/httpie/output/ui/man_pages.py index 0ba4974578..c0fdf465ff 100644 --- a/httpie/output/ui/man_pages.py +++ b/httpie/output/ui/man_pages.py @@ -1,7 +1,8 @@ """Logic for checking and displaying man pages.""" -import subprocess import os +import subprocess +import sys from httpie.context import Environment @@ -18,7 +19,7 @@ def is_available(program: str) -> bool: Check whether `program`'s man pages are available on this system. """ - if NO_MAN_PAGES or os.system == 'nt': + if NO_MAN_PAGES or sys.platform == 'win32': return False try: process = subprocess.run( diff --git a/tests/test_man_pages.py b/tests/test_man_pages.py new file mode 100644 index 0000000000..9b4c25625b --- /dev/null +++ b/tests/test_man_pages.py @@ -0,0 +1,12 @@ +from unittest.mock import Mock + +from httpie.output.ui import man_pages + + +def test_man_pages_are_unavailable_on_windows(monkeypatch): + run = Mock() + monkeypatch.setattr(man_pages.sys, 'platform', 'win32') + monkeypatch.setattr(man_pages.subprocess, 'run', run) + + assert man_pages.is_available('http') is False + run.assert_not_called()