Skip to content

Commit

Permalink
Merge branch 'main' into 1.0.0-wip
Browse files Browse the repository at this point in the history
  • Loading branch information
GhostofGoes committed Jul 16, 2024
2 parents 535e42e + 68c1482 commit 3be4311
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion getmac/getmac.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions tests/test_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ python =
PLATFORM =
ubuntu-20.04: linux
ubuntu-latest: linux
macos-13: macos
macos-latest: macos
windows-latest: windows

Expand Down

0 comments on commit 3be4311

Please sign in to comment.