-
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #548 from jaraco/feature/macos-non-viable
Fix broken CI due to broken macOS tests
- Loading branch information
Showing
5 changed files
with
44 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,23 @@ | ||
import platform | ||
import ctypes | ||
|
||
collect_ignore = ["hook-keyring.backend.py"] | ||
|
||
if platform.system() != 'Darwin': | ||
collect_ignore.append('keyring/backends/macOS/api.py') | ||
|
||
def macos_api_ignore(): | ||
""" | ||
Starting with macOS 11, the security API becomes | ||
non-viable except on universal2 binaries. | ||
Ref #525. | ||
""" | ||
|
||
try: | ||
ctypes.CDLL(ctypes.util.find_library('Security')).SecItemAdd | ||
return False | ||
except Exception: | ||
return True | ||
|
||
|
||
collect_ignore.extend(['keyring/backends/macOS/api.py'] * macos_api_ignore()) | ||
|
||
collect_ignore.append('keyring/devpi_client.py') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
import sys | ||
|
||
import pytest | ||
|
||
import keyring | ||
from keyring.testing.backend import BackendBasicTests | ||
from keyring.backends import macOS | ||
|
||
|
||
def is_osx_keychain_supported(): | ||
return sys.platform in ('mac', 'darwin') | ||
|
||
|
||
@pytest.mark.skipif(not is_osx_keychain_supported(), reason="Needs macOS") | ||
class TestOSXKeychain(BackendBasicTests): | ||
@pytest.mark.skipif( | ||
not keyring.backends.macOS.Keyring.viable, | ||
reason="macOS backend not viable", | ||
) | ||
class Test_macOSKeychain(BackendBasicTests): | ||
def init_keyring(self): | ||
return macOS.Keyring() |