diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8087a4..508aae4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,11 +54,15 @@ jobs: platform: - ubuntu-20.04 - windows-latest - - macos-latest + # Fix tests failing on MacOS 14+ due to ARM architecture + # https://github.com/actions/setup-python/issues/825 + # TODO: update tests to use ARM MacOS with 14+, add + # architecture to the list of architectures above. + - macos-13 exclude: - platform: ubuntu-20.04 architecture: x86 - - platform: macos-latest + - platform: macos-13 architecture: x86 # Not sure why, but 3.7 on x86 windows is cursed in CI # It passes (for now), however it's quite slow, diff --git a/CHANGELOG.md b/CHANGELOG.md index 9de2a4c..946c96c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,7 +30,7 @@ * Remove all `requirement.txt` files * Remove `setup.py` and `MANIFEST.in` -## 0.9.5 () +## 0.9.5 (07/15/2024) ### Changed * Fixed macOS arp when MAC has one character sections in specific cases (Fixes issue #92) diff --git a/getmac/getmac.py b/getmac/getmac.py index 4a8aba8..7dacc91 100644 --- a/getmac/getmac.py +++ b/getmac/getmac.py @@ -397,7 +397,10 @@ def get(self, arg: str) -> Optional[str]: command_output = _popen("arp", " ".join(cmd_args)) escaped = re.escape(arg) - return _search(r"\(" + escaped + self._good_regex, command_output) + _good_regex = ( + self._regex_darwin if DARWIN or SOLARIS else self._regex_std + ) # type: str + return _search(r"\(" + escaped + _good_regex, command_output) class ArpExe(Method): diff --git a/tests/test_methods.py b/tests/test_methods.py index f45ffa4..73966d2 100644 --- a/tests/test_methods.py +++ b/tests/test_methods.py @@ -508,6 +508,10 @@ def test_defaultifaceroutegetcommand_samples( def test_arp_various_args(benchmark, mocker, get_sample, mac, ip, sample_file): content = get_sample(sample_file) mocker.patch("getmac.getmac._popen", return_value=content) + if "OSX" in sample_file: + mocker.patch("getmac.getmac.DARWIN", return_value=True) + elif "solaris" in sample_file: + mocker.patch("getmac.getmac.SOLARIS", return_value=True) result = benchmark(getmac.ArpVariousArgs().get, arg=ip) # NOTE: Darwin and Solaris will return MACs without leading zeroes, diff --git a/tox.ini b/tox.ini index e018826..1d7f5fa 100644 --- a/tox.ini +++ b/tox.ini @@ -15,6 +15,7 @@ python = PLATFORM = ubuntu-20.04: linux ubuntu-latest: linux + macos-13: macos macos-latest: macos windows-latest: windows