from __future__ import print_function

import sys
import unittest

import keyring.backends.Windows
from ..test_backend import BackendBasicTests


@unittest.skipUnless(keyring.backends.Windows.WinVaultKeyring.viable,
    "Needs Windows")
class WinVaultKeyringTestCase(BackendBasicTests, unittest.TestCase):
    def tearDown(self):
        # clean up any credentials created
        for cred in self.credentials_created:
            try:
                self.keyring.delete_password(*cred)
            except Exception as e:
                print(e, file=sys.stderr)

    def init_keyring(self):
        return keyring.backends.Windows.WinVaultKeyring()

@@ -60,16 +60,31 @@
 ittest%0A%0A
+import pytest%0A%0A
 import k
@@ -660,8 +660,228 @@
 yring()%0A
+%0A%0A@pytest.mark.skipif('sys.platform != %22win32%22')%0Adef test_winvault_always_viable():%0A    %22%22%22%0A    The WinVault backend should always be viable on Windows.%0A    %22%22%22%0A    assert keyring.backends.Windows.WinVaultKeyring.viable%0A

Add a test to ensure winvault is always viable on Windows. Ref #278.