import pytest

import keyring
from keyring.testing.backend import BackendBasicTests
from keyring.backends import macOS


@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()

import pytest

import keyring
from keyring.testing.backend import BackendBasicTests
from keyring.backends import macOS


@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()

    @pytest.mark.xfail
    def test_alternate_keychain(self):
        alt = self.keyring.with_keychain('abcd')
        assert alt.keychain == 'abcd'
        assert self.keyring.keychain is None

Add test capturing need for an alternate keyring with an alternate keychain.
Add test capturing need for an alternate keyring with an alternate keychain.

  import pytest
  
  import keyring
  from keyring.testing.backend import BackendBasicTests
  from keyring.backends import macOS
  
  
  @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()
  
+     @pytest.mark.xfail
+     def test_alternate_keychain(self):
+         alt = self.keyring.with_keychain('abcd')
+         assert alt.keychain == 'abcd'
+         assert self.keyring.keychain is None
+ 
Add test capturing need for an alternate keyring with an alternate keychain.
## Code Before:
import pytest

import keyring
from keyring.testing.backend import BackendBasicTests
from keyring.backends import macOS


@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()

## Instruction:
Add test capturing need for an alternate keyring with an alternate keychain.
## Code After:
import pytest

import keyring
from keyring.testing.backend import BackendBasicTests
from keyring.backends import macOS


@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()

    @pytest.mark.xfail
    def test_alternate_keychain(self):
        alt = self.keyring.with_keychain('abcd')
        assert alt.keychain == 'abcd'
        assert self.keyring.keychain is None
