Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pingparsing for openSUSE:Factory checked in at 2021-05-18 18:26:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pingparsing (Old) and /work/SRC/openSUSE:Factory/.python-pingparsing.new.2988 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pingparsing" Tue May 18 18:26:51 2021 rev:10 rq:893502 version:1.3.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pingparsing/python-pingparsing.changes 2021-04-01 14:18:10.180060171 +0200 +++ /work/SRC/openSUSE:Factory/.python-pingparsing.new.2988/python-pingparsing.changes 2021-05-18 18:27:11.474767686 +0200 @@ -1,0 +2,14 @@ +Sun May 16 20:20:41 UTC 2021 - Matej Cepl <mc...@suse.com> + +- Actually depends on subprocrunner >= 1.2.2 (and thus on + sr#893494) + +------------------------------------------------------------------- +Thu May 13 16:42:28 UTC 2021 - Martin Hauke <mar...@gmx.de> + +- Update to version 1.3.1 + * Change PingTransmitter.ping_option accepts Sequence + * Fix a problem that --interface option value is not properly + applied to ping commands + +------------------------------------------------------------------- Old: ---- pingparsing-1.3.0.tar.gz New: ---- pingparsing-1.3.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pingparsing.spec ++++++ --- /var/tmp/diff_new_pack.2BBmFk/_old 2021-05-18 18:27:11.918765761 +0200 +++ /var/tmp/diff_new_pack.2BBmFk/_new 2021-05-18 18:27:11.918765761 +0200 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-pingparsing -Version: 1.3.0 +Version: 1.3.1 Release: 0 Summary: CLI-tool/Python-library for parsing ping command output License: MIT @@ -35,10 +35,10 @@ Requires: python-pytz >= 2018.9 Requires: python-setuptools >= 38.3.0 Requires: python-simplejson -Requires: python-subprocrunner >= 1.2.1 +Requires: python-subprocrunner >= 1.2.2 Requires: python-typepy >= 1.1.0 Requires(post): update-alternatives -Requires(postun): update-alternatives +Requires(postun):update-alternatives BuildArch: noarch # SECTION test requirements BuildRequires: %{python_module humanreadable >= 0.1.0} @@ -46,7 +46,7 @@ BuildRequires: %{python_module pytest} BuildRequires: %{python_module pytz >= 2018.9} BuildRequires: %{python_module simplejson} -BuildRequires: %{python_module subprocrunner >= 1.2.1} +BuildRequires: %{python_module subprocrunner >= 1.2.2} BuildRequires: %{python_module typepy >= 1.1.0} # /SECTION %python_subpackages ++++++ pingparsing-1.3.0.tar.gz -> pingparsing-1.3.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pingparsing-1.3.0/.github/workflows/tests.yml new/pingparsing-1.3.1/.github/workflows/tests.yml --- old/pingparsing-1.3.0/.github/workflows/tests.yml 2021-03-27 18:17:45.000000000 +0100 +++ new/pingparsing-1.3.1/.github/workflows/tests.yml 2021-05-05 09:44:57.000000000 +0200 @@ -8,7 +8,7 @@ strategy: fail-fast: false matrix: - python-version: [3.5, 3.6, 3.7, 3.8, 3.9, 3.10.0-alpha.4, pypy3] + python-version: [3.5, 3.6, 3.7, 3.8, 3.9, 3.10.0-beta.1, pypy3] os: [ubuntu-latest, macos-latest, windows-latest] steps: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pingparsing-1.3.0/Makefile new/pingparsing-1.3.1/Makefile --- old/pingparsing-1.3.0/Makefile 2021-03-27 18:17:45.000000000 +0100 +++ new/pingparsing-1.3.1/Makefile 2021-05-05 09:44:57.000000000 +0200 @@ -1,3 +1,6 @@ +PYTHON := python3 + + .PHONY: build build: @make clean @@ -7,7 +10,6 @@ .PHONY: check check: @-tox -e lint - python3 -m pip check .PHONY: clean clean: @@ -20,7 +22,7 @@ .PHONY: idocs idocs: - @python3 -m pip install --upgrade . + @$(PYTHON) -m pip install -q --disable-pip-version-check --upgrade . @make docs .PHONY: fmt @@ -34,10 +36,10 @@ .PHONY: release release: - @python setup.py release --sign + @$(PYTHON) setup.py release --sign --search-dir pingparsing @make clean .PHONY: setup setup: - @python3 -m pip install --upgrade -e .[test] releasecmd tox - python3 -m pip check + @$(PYTHON) -m pip install -q --disable-pip-version-check --upgrade -e .[test] releasecmd tox + @$(PYTHON) -m pip check diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pingparsing-1.3.0/pingparsing/__main__.py new/pingparsing-1.3.1/pingparsing/__main__.py --- old/pingparsing-1.3.0/pingparsing/__main__.py 2021-03-27 18:17:45.000000000 +0100 +++ new/pingparsing-1.3.1/pingparsing/__main__.py 2021-05-05 09:44:57.000000000 +0200 @@ -20,7 +20,7 @@ from ._logger import logger, set_logger from ._pingparsing import PingParsing from ._pingtransmitter import PingTransmitter -from ._typing import TimeArg +from ._typing import PingAddOpts, TimeArg try: @@ -205,7 +205,8 @@ if log_level == LogLevel.DEBUG: log_format = ( "<level>{level: <8}</level> | " - "<cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>" + "<cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> - " + "<level>{message}</level>" ) try: @@ -242,7 +243,7 @@ is_parse_icmp_reply: bool, timestamp: str, timezone_name: str, - addopts: str, + addopts: PingAddOpts, ) -> Tuple[str, Any]: if os.path.isfile(dest_or_file): with open(dest_or_file) as f: @@ -386,7 +387,7 @@ options.icmp_reply, options.timestamp, options.timezone, - options.addopts, + options.addopts if options.addopts is not None else [], ) ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pingparsing-1.3.0/pingparsing/__version__.py new/pingparsing-1.3.1/pingparsing/__version__.py --- old/pingparsing-1.3.0/pingparsing/__version__.py 2021-03-27 18:17:45.000000000 +0100 +++ new/pingparsing-1.3.1/pingparsing/__version__.py 2021-05-05 09:44:57.000000000 +0200 @@ -1,6 +1,6 @@ __author__ = "Tsuyoshi Hombashi" __copyright__ = "Copyright 2016, {}".format(__author__) __license__ = "MIT License" -__version__ = "1.3.0" +__version__ = "1.3.1" __maintainer__ = __author__ __email__ = "tsuyoshi.homba...@gmail.com" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pingparsing-1.3.0/pingparsing/_cmd_maker.py new/pingparsing-1.3.1/pingparsing/_cmd_maker.py --- old/pingparsing-1.3.0/pingparsing/_cmd_maker.py 2021-03-27 18:17:45.000000000 +0100 +++ new/pingparsing-1.3.1/pingparsing/_cmd_maker.py 2021-05-05 09:44:57.000000000 +0200 @@ -1,10 +1,12 @@ import abc import math -import re from typing import List, Optional import humanreadable as hr -from typepy import Integer, TypeConversionError +from subprocrunner.typing import Command +from typepy import Integer + +from ._typing import PingAddOpts DEFAULT_DEADLINE = 3 @@ -22,9 +24,12 @@ is_ipv6: bool = False, timestamp: bool = False, auto_codepage: bool = False, - ping_option: Optional[str] = None, + ping_option: PingAddOpts = "", ): self.count = count + if self.count is not None: + self.count = Integer(self.count).convert() + self.deadline = deadline self.timeout = timeout self._packet_size = packet_size @@ -35,34 +40,34 @@ self.auto_codepage = auto_codepage self.ping_option = ping_option - def make_cmd(self, destination: str) -> str: - command_items = self._get_initial_options() - command_items.extend( - [ - self._get_builtin_ping_command(), - self._get_deadline_option(), - self._get_timeout_option(), - self._get_count_option(), - ] + def make_cmd(self, destination: str) -> Command: + command_items = ( + self._get_initial_command() + + self._get_ping_command() + + self._get_interface_option() + + self._get_deadline_option() + + self._get_timeout_option() + + self._get_count_option() + + self._get_packet_size_option() + + self._get_ttl_option() ) - if self._packet_size: - command_items.extend(self._get_packet_size_option()) - - if self._ttl: - command_items.extend(self._get_ttl_option()) - if self._timestamp: - command_items.append(self._get_timestamp_option()) + command_items.extend(self._get_timestamp_option()) - if self.ping_option: - command_items.append(self.ping_option) + if isinstance(self.ping_option, str): + command_items.extend(self.ping_option.strip().split()) + else: + command_items.extend(self.ping_option) command_items.append(self._get_destination_host(destination)) - return re.sub(r"[\s]{2,}", " ", " ".join(command_items)) + if self._require_shell_command(): + return " ".join(command_items) + + return command_items - def _get_initial_options(self) -> List[str]: + def _get_initial_command(self) -> List[str]: return [] @abc.abstractmethod @@ -70,7 +75,7 @@ raise NotImplementedError() @abc.abstractmethod - def _get_builtin_ping_command(self) -> str: + def _get_ping_command(self) -> List[str]: raise NotImplementedError() @abc.abstractmethod @@ -78,19 +83,19 @@ raise NotImplementedError() @abc.abstractmethod - def _get_timestamp_option(self) -> str: + def _get_timestamp_option(self) -> List[str]: raise NotImplementedError() @abc.abstractmethod - def _get_deadline_option(self) -> str: + def _get_deadline_option(self) -> List[str]: raise NotImplementedError() @abc.abstractmethod - def _get_timeout_option(self) -> str: + def _get_timeout_option(self) -> List[str]: raise NotImplementedError() @abc.abstractmethod - def _get_count_option(self) -> str: + def _get_count_option(self) -> List[str]: raise NotImplementedError() @abc.abstractmethod @@ -101,43 +106,53 @@ def _get_ttl_option(self) -> List[str]: raise NotImplementedError() + def _get_interface_option(self) -> List[str]: + return [] + + def _require_shell_command(self) -> bool: + return False + class PosixPingCmdMaker(PingCmdMaker): def _get_destination_host(self, destination: str) -> str: return destination - def _get_builtin_ping_command(self) -> str: + def _get_ping_command(self) -> List[str]: if self._is_ipv6: - return "ping6" + return ["ping6"] - return "ping" + return ["ping"] def _get_quiet_option(self) -> str: return "-q" - def _get_timestamp_option(self) -> str: - return "-D -O" + def _get_timestamp_option(self) -> List[str]: + return ["-D", "-O"] - def _get_count_option(self) -> str: - try: - count = Integer(self.count).convert() - except TypeConversionError: - return "" + def _get_count_option(self) -> List[str]: + if self.count is None: + return [] - return "-c {:d}".format(count) + return ["-c", str(self.count)] def _get_packet_size_option(self) -> List[str]: + if self._packet_size is None: + return [] + return ["-s", str(self._packet_size)] class MacosPingCmdMaker(PosixPingCmdMaker): def _get_ttl_option(self) -> List[str]: + if self._ttl is None: + return [] + return ["-T", str(self._ttl)] - def _get_deadline_option(self) -> str: + def _get_deadline_option(self) -> List[str]: if self.deadline is None: if self.count: - return "" + return [] deadline = DEFAULT_DEADLINE else: @@ -146,38 +161,47 @@ if self._is_ipv6: # there is no timeout option for macOS ping6. # so, using -i and -c option to simulate timeout. - return "-i 1 -c {:d}".format(deadline) + return ["-i", "1", "-c", str(deadline)] - return "-t {:d}".format(deadline) + return ["-t", str(deadline)] - def _get_timeout_option(self) -> str: - return "" + def _get_timeout_option(self) -> List[str]: + return [] class LinuxPingCmdMaker(PosixPingCmdMaker): def _get_ttl_option(self) -> List[str]: + if self._ttl is None: + return [] + return ["-t", str(self._ttl)] - def _get_deadline_option(self) -> str: + def _get_deadline_option(self) -> List[str]: if self.deadline is None: if self.count: - return "" + return [] deadline = DEFAULT_DEADLINE else: deadline = int(math.ceil(self.deadline.seconds)) - return "-w {:d}".format(deadline) + return ["-w", str(deadline)] - def _get_timeout_option(self) -> str: + def _get_timeout_option(self) -> List[str]: if self.timeout is None: - return "" + return [] + + return ["-W", str(int(math.ceil(self.timeout.seconds)))] + + def _get_interface_option(self) -> List[str]: + if not self.interface: + return [] - return "-W {:d}".format(int(math.ceil(self.timeout.seconds))) + return ["-I", self.interface] class WindowsPingCmdMaker(PingCmdMaker): - def _get_initial_options(self) -> List[str]: + def _get_initial_command(self) -> List[str]: if self.auto_codepage: return ["chcp 437 &"] @@ -189,43 +213,50 @@ return destination - def _get_builtin_ping_command(self) -> str: - return "ping" + def _get_ping_command(self) -> List[str]: + return ["ping"] def _get_quiet_option(self) -> str: return "" - def _get_timestamp_option(self) -> str: - return "" + def _get_timestamp_option(self) -> List[str]: + return [] - def _get_deadline_option(self) -> str: + def _get_deadline_option(self) -> List[str]: if self.deadline is None: if self.count: - return "" + return [] deadline = DEFAULT_DEADLINE else: deadline = int(math.ceil(self.deadline.seconds)) # ping for Windows does not have the option with equals to the deadline option. - return "-n {:d}".format(deadline) + return ["-n", str(deadline)] - def _get_timeout_option(self) -> str: + def _get_timeout_option(self) -> List[str]: if self.timeout is None: - return "" + return [] - return "-w {:d}".format(int(math.ceil(self.timeout.milliseconds))) + return ["-w", str(int(math.ceil(self.timeout.milliseconds)))] - def _get_count_option(self) -> str: - try: - count = Integer(self.count).convert() - except TypeConversionError: - return "" + def _get_count_option(self) -> List[str]: + if self.count is None: + return [] - return "-n {:d}".format(count) + return ["-n", str(self.count)] def _get_packet_size_option(self) -> List[str]: + if self._packet_size is None: + return [] + return ["-l", str(self._packet_size)] def _get_ttl_option(self) -> List[str]: + if self._ttl is None: + return [] + return ["-i", str(self._ttl)] + + def _require_shell_command(self) -> bool: + return self.auto_codepage diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pingparsing-1.3.0/pingparsing/_pingtransmitter.py new/pingparsing-1.3.1/pingparsing/_pingtransmitter.py --- old/pingparsing-1.3.0/pingparsing/_pingtransmitter.py 2021-03-27 18:17:45.000000000 +0100 +++ new/pingparsing-1.3.1/pingparsing/_pingtransmitter.py 2021-05-05 09:44:57.000000000 +0200 @@ -10,11 +10,12 @@ import humanreadable as hr import subprocrunner import typepy +from subprocrunner.typing import Command from typepy import Integer, StrictLevel, String, TypeConversionError from ._cmd_maker import LinuxPingCmdMaker, MacosPingCmdMaker, WindowsPingCmdMaker from ._logger import logger -from ._typing import TimeArg +from ._typing import PingAddOpts, TimeArg DEFAULT_DEADLINE = 3 @@ -65,7 +66,7 @@ Specifies the Time to Live. .. py:attribute:: ping_option - :type: str + :type: Union[str, Sequence[str]] :value: "" Additional ``ping`` command option. @@ -222,7 +223,7 @@ self.count = None # type: Optional[int] self.packet_size = None # type: Optional[int] self.ttl = None # type: Optional[int] - self.ping_option = "" + self.ping_option = [] # type: PingAddOpts self.is_quiet = False self.interface = None # type: Optional[str] self.auto_codepage = True @@ -296,7 +297,7 @@ if typepy.is_null_string(self.interface): raise ValueError("interface required to ping to IPv6 link local address") - def __make_ping_command(self) -> str: + def __make_ping_command(self) -> Command: from typing import Any # noqa maker_class = None # type: Any diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pingparsing-1.3.0/pingparsing/_typing.py new/pingparsing-1.3.1/pingparsing/_typing.py --- old/pingparsing-1.3.0/pingparsing/_typing.py 2021-03-27 18:17:45.000000000 +0100 +++ new/pingparsing-1.3.1/pingparsing/_typing.py 2021-05-05 09:44:57.000000000 +0200 @@ -6,3 +6,4 @@ TimeArg = Union[hr.Time, int, str, None] IcmpReplies = Sequence[Dict[str, Union[str, bool, float, int, datetime]]] +PingAddOpts = Union[str, Sequence[str]] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pingparsing-1.3.0/pylama.ini new/pingparsing-1.3.1/pylama.ini --- old/pingparsing-1.3.0/pylama.ini 2021-03-27 18:17:45.000000000 +0100 +++ new/pingparsing-1.3.1/pylama.ini 2021-05-05 09:44:57.000000000 +0200 @@ -15,10 +15,6 @@ # W0611: imported but unused [pyflakes] ignore = W0611 -[pylama:test/*] -# E231: missing whitespace after ',' [pycodestyle] -ignore = E231 - [pylama:test/test_pingparsing.py] # W0404: redefinition of unused 'XXX' [pyflakes] ignore = W0404 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pingparsing-1.3.0/requirements/requirements.txt new/pingparsing-1.3.1/requirements/requirements.txt --- old/pingparsing-1.3.0/requirements/requirements.txt 2021-03-27 18:17:45.000000000 +0100 +++ new/pingparsing-1.3.1/requirements/requirements.txt 2021-05-05 09:44:57.000000000 +0200 @@ -1,4 +1,4 @@ humanreadable>=0.1.0,<1 pyparsing>=2.0.3,<3 -subprocrunner>=1.2.1,<2 +subprocrunner>=1.2.2,<2 typepy[datetime]>=1.1.0,<2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pingparsing-1.3.0/test/test_cmd_maker.py new/pingparsing-1.3.1/test/test_cmd_maker.py --- old/pingparsing-1.3.0/test/test_cmd_maker.py 2021-03-27 18:17:45.000000000 +0100 +++ new/pingparsing-1.3.1/test/test_cmd_maker.py 2021-05-05 09:44:57.000000000 +0200 @@ -13,9 +13,9 @@ @pytest.mark.parametrize( ["maker_class", "host", "expected"], [ - [LinuxPingCmdMaker, "127.0.0.1", "ping -w 3 127.0.0.1"], - [MacosPingCmdMaker, "127.0.0.1", "ping -t 3 127.0.0.1"], - [WindowsPingCmdMaker, "127.0.0.1", "ping -n 3 127.0.0.1"], + [LinuxPingCmdMaker, "127.0.0.1", ["ping", "-w", "3", "127.0.0.1"]], + [MacosPingCmdMaker, "127.0.0.1", ["ping", "-t", "3", "127.0.0.1"]], + [WindowsPingCmdMaker, "127.0.0.1", ["ping", "-n", "3", "127.0.0.1"]], ], ) def test_normal_dest(self, maker_class, host, expected): @@ -24,7 +24,7 @@ @pytest.mark.parametrize( ["maker_class", "host", "deadline", "expected"], [ - [LinuxPingCmdMaker, "localhost", "1sec", "ping -w 1 localhost"], + [LinuxPingCmdMaker, "localhost", "1sec", "ping -w 1 localhost".split()], ], ) def test_normal_deadline(self, maker_class, host, deadline, expected): @@ -33,12 +33,36 @@ @pytest.mark.parametrize( ["maker_class", "host", "ipv6", "timeout", "expected"], [ - [LinuxPingCmdMaker, "localhost", False, "1sec", "ping -w 3 -W 1 localhost"], - [LinuxPingCmdMaker, "localhost", True, "1sec", "ping6 -w 3 -W 1 localhost"], - [MacosPingCmdMaker, "localhost", False, "1sec", "ping -t 3 localhost"], - [MacosPingCmdMaker, "localhost", True, "1sec", "ping6 -i 1 -c 3 localhost"], - [WindowsPingCmdMaker, "localhost", False, "1sec", "ping -n 3 -w 1000 localhost"], - [WindowsPingCmdMaker, "localhost", True, "1sec", "ping -n 3 -w 1000 localhost%eth0"], + [ + LinuxPingCmdMaker, + "localhost", + False, + "1sec", + "ping -I eth0 -w 3 -W 1 localhost".split(), + ], + [ + LinuxPingCmdMaker, + "localhost", + True, + "1sec", + "ping6 -I eth0 -w 3 -W 1 localhost".split(), + ], + [MacosPingCmdMaker, "localhost", False, "1sec", "ping -t 3 localhost".split()], + [MacosPingCmdMaker, "localhost", True, "1sec", "ping6 -i 1 -c 3 localhost".split()], + [ + WindowsPingCmdMaker, + "localhost", + False, + "1sec", + "ping -n 3 -w 1000 localhost".split(), + ], + [ + WindowsPingCmdMaker, + "localhost", + True, + "1sec", + "ping -n 3 -w 1000 localhost%eth0".split(), + ], ], ) def test_normal_timeout(self, maker_class, host, ipv6, timeout, expected): @@ -52,9 +76,9 @@ @pytest.mark.parametrize( ["maker_class", "host", "count", "expected"], [ - [LinuxPingCmdMaker, "localhost", 1, "ping -c 1 localhost"], - [MacosPingCmdMaker, "localhost", 1, "ping -c 1 localhost"], - [WindowsPingCmdMaker, "localhost", 1, "ping -n 1 localhost"], + [LinuxPingCmdMaker, "localhost", 1, "ping -c 1 localhost".split()], + [MacosPingCmdMaker, "localhost", 1, "ping -c 1 localhost".split()], + [WindowsPingCmdMaker, "localhost", 1, "ping -n 1 localhost".split()], ], ) def test_normal_count(self, maker_class, host, count, expected): @@ -63,9 +87,9 @@ @pytest.mark.parametrize( ["maker_class", "host", "packet_size", "expected"], [ - [LinuxPingCmdMaker, "localhost", 6000, "ping -c 1 -s 6000 localhost"], - [MacosPingCmdMaker, "localhost", 6000, "ping -c 1 -s 6000 localhost"], - [WindowsPingCmdMaker, "localhost", 6000, "ping -n 1 -l 6000 localhost"], + [LinuxPingCmdMaker, "localhost", 6000, "ping -c 1 -s 6000 localhost".split()], + [MacosPingCmdMaker, "localhost", 6000, "ping -c 1 -s 6000 localhost".split()], + [WindowsPingCmdMaker, "localhost", 6000, "ping -n 1 -l 6000 localhost".split()], ], ) def test_normal_packet_size(self, maker_class, host, packet_size, expected): @@ -74,9 +98,9 @@ @pytest.mark.parametrize( ["maker_class", "host", "ttl", "expected"], [ - [LinuxPingCmdMaker, "localhost", 32, "ping -c 1 -t 32 localhost"], - [MacosPingCmdMaker, "localhost", 32, "ping -c 1 -T 32 localhost"], - [WindowsPingCmdMaker, "localhost", 32, "ping -n 1 -i 32 localhost"], + [LinuxPingCmdMaker, "localhost", 32, "ping -c 1 -t 32 localhost".split()], + [MacosPingCmdMaker, "localhost", 32, "ping -c 1 -T 32 localhost".split()], + [WindowsPingCmdMaker, "localhost", 32, "ping -n 1 -i 32 localhost".split()], ], ) def test_normal_ttl(self, maker_class, host, ttl, expected): @@ -85,9 +109,9 @@ @pytest.mark.parametrize( ["maker_class", "host", "expected"], [ - [LinuxPingCmdMaker, "localhost", "ping -c 1 -D -O localhost"], - [MacosPingCmdMaker, "localhost", "ping -c 1 -D -O localhost"], - [WindowsPingCmdMaker, "localhost", "ping -n 1 localhost"], + [LinuxPingCmdMaker, "localhost", "ping -c 1 -D -O localhost".split()], + [MacosPingCmdMaker, "localhost", "ping -c 1 -D -O localhost".split()], + [WindowsPingCmdMaker, "localhost", "ping -n 1 localhost".split()], ], ) def test_normal_timestamp(self, maker_class, host, expected): @@ -96,8 +120,8 @@ @pytest.mark.parametrize( ["maker_class", "host", "expected"], [ - [LinuxPingCmdMaker, "localhost", "ping -c 1 localhost"], - [MacosPingCmdMaker, "localhost", "ping -c 1 localhost"], + [LinuxPingCmdMaker, "localhost", "ping -c 1 localhost".split()], + [MacosPingCmdMaker, "localhost", "ping -c 1 localhost".split()], [WindowsPingCmdMaker, "localhost", "chcp 437 & ping -n 1 localhost"], ], ) @@ -107,10 +131,13 @@ @pytest.mark.parametrize( ["maker_class", "host", "expected"], [ - [LinuxPingCmdMaker, "localhost", "ping -c 1 -a localhost"], - [MacosPingCmdMaker, "localhost", "ping -c 1 -a localhost"], - [WindowsPingCmdMaker, "localhost", "ping -n 1 -a localhost"], + [LinuxPingCmdMaker, "localhost", "ping -c 1 -a -b localhost".split()], + [MacosPingCmdMaker, "localhost", "ping -c 1 -a -b localhost".split()], + [WindowsPingCmdMaker, "localhost", "ping -n 1 -a -b localhost".split()], ], ) def test_normal_ping_option(self, maker_class, host, expected): - assert maker_class(ping_option="-a", count=1).make_cmd(destination=host) == expected + cmd_0 = maker_class(ping_option="-a -b", count=1).make_cmd(destination=host) + cmd_1 = maker_class(ping_option=["-a", "-b"], count=1).make_cmd(destination=host) + assert cmd_0 == expected + assert cmd_1 == expected