Skip symlink tests on Windows

... where there is no symlinking.
This commit is contained in:
Adrian Sampson 2015-04-23 17:39:18 -07:00
parent 0e3f6cb09d
commit ba87ea1f30
3 changed files with 7 additions and 0 deletions

View file

@ -53,6 +53,9 @@ log.setLevel(logging.DEBUG)
# Dummy item creation.
_item_ident = 0
# OS feature test.
HAVE_SYMLINK = hasattr(os, 'symlink')
def item(lib=None):
global _item_ident

View file

@ -124,16 +124,19 @@ class MoveTest(_common.TestCase):
self.assertEqual(os.path.dirname(self.i.path),
os.path.dirname(dest))
@unittest.skipUnless(_common.HAVE_SYMLINK, "need symlinks")
def test_link_arrives(self):
self.i.move(link=True)
self.assertExists(self.dest)
self.assertTrue(os.path.islink(self.dest))
self.assertEqual(os.readlink(self.dest), self.path)
@unittest.skipUnless(_common.HAVE_SYMLINK, "need symlinks")
def test_link_does_not_depart(self):
self.i.move(link=True)
self.assertExists(self.path)
@unittest.skipUnless(_common.HAVE_SYMLINK, "need symlinks")
def test_link_changes_path(self):
self.i.move(link=True)
self.assertEqual(self.i.path, util.normpath(self.dest))

View file

@ -329,6 +329,7 @@ class NonAutotaggedImportTest(_common.TestCase, ImportHelper):
self.importer.run()
self.assertNotExists(os.path.join(self.import_dir, 'the_album'))
@unittest.skipUnless(_common.HAVE_SYMLINK, "need symlinks")
def test_import_link_arrives(self):
config['import']['link'] = True
self.importer.run()