Commits

r...@eml.cc  committed 00e9b36

Fix for pyfilesystem bug causing windows pyfilesystem keyring tests to fail - Issue 78

  • Participants
  • Parent commits db5ee77
  • Branches issue_78

Comments (0)

Files changed (2)

File keyring/backends/pyfs.py

                     if self._cache_timeout is not None:
                         pyfs = fs.remote.CacheFS(
                             pyfs, cache_timeout=self._cache_timeout)
-                    url2_path, url2_filename = fs.path.split(url2)
+                    # NOTE: fs.path.split does not function in the same way os os.path.split... at least under windows
+                    url2_path, url2_filename = os.path.split(url2)
                     if url2_path and not pyfs.exists(url2_path):
                         pyfs.makedir(url2_path, recursive=True)
                 else:
                     # assume local filesystem
                     import fs.osfs
                     full_url = fs.opener._expand_syspath(self.filename)
-                    url2_path, url2 = fs.path.split(full_url)
+                    # NOTE: fs.path.split does not function in the same way os os.path.split... at least under windows
+                    url2_path, url2 = os.path.split(full_url)
                     pyfs = fs.osfs.OSFS(url2_path)
 
                 try:

File keyring/tests/backends/test_pyfs.py

         return False
     return True
 
-# Due to a `bug <https://bitbucket.org/kang/python-keyring-lib/issue/78>`_
-# in our usage of pyfilesystem, the tests fail on Windows, so mark them as
-# such.
-xfail_win = (unittest.expectedFailure
-    if platform.system() == 'Windows' else lambda func: func)
 
 class ReverseCrypter(keyring.backend.Crypter):
     """Very silly crypter class"""
 
         self.assertEqual(password, self.keyring.decrypt(encrypted))
 
-@xfail_win
 @unittest.skipUnless(is_pyfilesystem_supported(),
                      "Need Pyfilesystem")
 class UnencryptedMemoryPyfilesystemKeyringNoSubDirTestCase(
         return keyring.backend.UnencryptedPyfilesystemKeyring(
             filename=self.keyring_filename)
 
-@xfail_win
 @unittest.skipUnless(is_pyfilesystem_supported(),
                      "Need Pyfilesystem")
 class UnencryptedMemoryPyfilesystemKeyringSubDirTestCase(
         return keyring.backend.UnencryptedPyfilesystemKeyring(
             filename=self.keyring_filename)
 
-@xfail_win
 @unittest.skipUnless(is_pyfilesystem_supported(),
                      "Need Pyfilesystem")
 class UnencryptedLocalPyfilesystemKeyringNoSubDirTestCase(
         if os.path.exists(self.keyring_filename):
             os.remove(self.keyring_filename)
 
-@xfail_win
 @unittest.skipUnless(is_pyfilesystem_supported(),
                      "Need Pyfilesystem")
 class UnencryptedLocalPyfilesystemKeyringSubDirTestCase(
     unittest.TestCase):
     """Test using local temp files with no encryption"""
 
-    keyring_dir = '%s//more/sub/dirs' %tempfile.mkdtemp()
-    keyring_filename = '%s/keyring.cfg' %keyring_dir
+    keyring_dir = os.path.join(tempfile.mkdtemp(), 'more', 'sub', 'dirs')
+    keyring_filename = os.path.join(keyring_dir, 'keyring.cfg')
 
     def init_keyring(self):
 
         return keyring.backend.UnencryptedPyfilesystemKeyring(
             filename=self.keyring_filename)
 
-@xfail_win
 @unittest.skipUnless(is_pyfilesystem_supported(),
                      "Need Pyfilesystem")
 class EncryptedMemoryPyfilesystemKeyringTestCase(PyfilesystemKeyringTests,
             ReverseCrypter(),
             filename='mem://encrypted/keyring.cfg')
 
-@xfail_win
 @unittest.skipUnless(is_pyfilesystem_supported(),
                      "Need Pyfilesystem")
 class EncryptedLocalPyfilesystemKeyringNoSubDirTestCase(
             ReverseCrypter(),
             filename='temp://keyring.cfg')
 
-@xfail_win
 @unittest.skipUnless(is_pyfilesystem_supported(),
                      "Need Pyfilesystem")
 class EncryptedLocalPyfilesystemKeyringSubDirTestCase(