Skip to content

Commit

Permalink
test: correctly handle macOS versions older than 10.10
Browse files Browse the repository at this point in the history
macOS versions older than 10.10 where not identified correctly.
The problem here is that `'macosx-10.6-x86_64' < 'macosx-10.13'` returns
False because the order is lexicographical and not numerical.

Thanks to worldofpeace for the bug report
#77
  • Loading branch information
LudovicRousseau committed Apr 6, 2019
1 parent e9d18b4 commit 62e6750
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions test/test_SCardGetErrorMessage.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ def test_SCardGetErrorMessage(self):
self.assertEqual(res, expected)

res = SCardGetErrorMessage(1)
expected = "Unknown error: 0x00000001"
# macOS bug not yet fixed
if get_platform().startswith('macosx-') and get_platform() < 'macosx-10.13':
expected = "Unkown error: 0x00000001"
else:
expected = "Unknown error: 0x00000001"
if get_platform().startswith('macosx-'):
version = get_platform() # something like 'macosx-10.14-x86_64'
version = version.split('-')[1] # '10.14'
major, minor = map(int, version.split('.')) # (10, 14)
if major == 10 and minor < 13:
expected = "Unkown error: 0x00000001"

self.assertEqual(res, expected)


Expand Down

0 comments on commit 62e6750

Please sign in to comment.