Commits

Jason R. Coombs  committed 8d0009a

Now TestCase subclasses are only created for concrete tests (not abstract ones not intended to be run). See http://stackoverflow.com/questions/4566910/abstract-test-case-using-python-unittest/4566992#4566992 for reasoning.

  • Participants
  • Parent commits 3a076ae

Comments (0)

Files changed (1)

File keyring/tests/test_backend.py

     return False
 
 
-class BackendBasicTestCase(unittest.TestCase):
+class BackendBasicTests(object):
     """Test for the keyring's basic funtions. password_set and password_get
     """
 
-    __test__ = False
-
     def setUp(self):
         self.keyring = self.init_keyring()
         self.credentials_created = set()
 
 @unittest.skipUnless(is_osx_keychain_supported(),
                      "Need OS X")
-class OSXKeychainTestCase(BackendBasicTestCase):
-    __test__ = True
+class OSXKeychainTestCase(BackendBasicTests, unittest.TestCase):
 
     def init_keyring(self):
         return keyring.backend.OSXKeychain()
 
 @unittest.skipUnless(is_gnomekeyring_supported(),
                      "Need GnomeKeyring")
-class GnomeKeyringTestCase(BackendBasicTestCase):
-    __test__ = True
+class GnomeKeyringTestCase(BackendBasicTests, unittest.TestCase):
 
     def environ(self):
         return dict(GNOME_KEYRING_CONTROL='1',
 
 @unittest.skipUnless(is_kwallet_supported(),
                      "Need KWallet")
-class KDEKWalletTestCase(BackendBasicTestCase):
-    __test__ = True
+class KDEKWalletTestCase(BackendBasicTests, unittest.TestCase):
 
     def init_keyring(self):
         return keyring.backend.KDEKWallet()
         app.exit()
 
 
-class FileKeyringTestCase(BackendBasicTestCase):
-    __test__ = False
+class FileKeyringTests(BackendBasicTests):
 
     def setUp(self):
-        super(FileKeyringTestCase, self).setUp()
+        super(FileKeyringTests, self).setUp()
         self.keyring = self.init_keyring()
         self.keyring.file_path = self.tmp_keyring_file = tempfile.mktemp()
 
         self.assertEqual(password, self.keyring.decrypt(encyrpted))
 
 
-class UncryptedFileKeyringTestCase(FileKeyringTestCase):
-    __test__ = True
+class UncryptedFileKeyringTestCase(FileKeyringTests, unittest.TestCase):
+
 
     def init_keyring(self):
         return keyring.backend.UncryptedFileKeyring()
 
 @unittest.skipUnless(is_crypto_supported(),
                      "Need Crypto module")
-class CryptedFileKeyringTestCase(FileKeyringTestCase):
-    __test__ = True
+class CryptedFileKeyringTestCase(FileKeyringTests, unittest.TestCase):
 
     def setUp(self):
         super(self.__class__, self).setUp()
 
 @unittest.skipUnless(is_win32_crypto_supported(),
                      "Need Windows")
-class Win32CryptoKeyringTestCase(FileKeyringTestCase):
-    __test__ = True
+class Win32CryptoKeyringTestCase(FileKeyringTests, unittest.TestCase):
 
     def init_keyring(self):
         return keyring.backend.Win32CryptoKeyring()
 
 @unittest.skipUnless(is_winvault_supported(),
                      "Need WinVault")
-class WinVaultKeyringTestCase(BackendBasicTestCase):
+class WinVaultKeyringTestCase(BackendBasicTests, unittest.TestCase):
     def tearDown(self):
         # clean up any credentials created
         for cred in self.credentials_created: