if destpath is None:
destpath = os.getcwd()
+ LOGGER.debug("Source_path: %s", source_path)
+ LOGGER.debug("Dest_path: %s", destpath)
for lib_id in self.results_order:
- abs_lib_path = os.path.abspath(self.results[lib_id])
- lib_path = os.path.relpath(abs_lib_path, destpath)
+ lib_path = self.results[lib_id]
+ LOGGER.debug("lib_path: %s", lib_path)
+ if os.path.isabs(lib_path):
+ lib_path = os.path.relpath(lib_path, destpath)
+
LOGGER.debug('lib_path: %s', lib_path)
lib_destination = os.path.join(destpath, lib_path)
if not os.path.exists(lib_destination):
self.assertFalse(u'77777' in results)
self.assertFalse('77777' in results)
- def test_make_from(self):
+ def test_make_from_absolute(self):
+ """Test that make from works if ResultMap has absolute paths
+ """
+ results = ResultMap()
+ sample1_dir = os.path.join(self.resultdir, S1_NAME)
+ sample2_dir = os.path.join(self.resultdir, S2_NAME)
+ results['1000'] = sample1_dir
+ results['2000'] = sample2_dir
+
+ results.make_tree_from(self.sourcedir, self.resultdir)
+ self.failUnless(os.path.isdir(sample1_dir))
+ self.failUnless(os.path.isdir(sample2_dir))
+
+ for f in S1_FILES + S2_FILES:
+ self.failUnless(
+ os.path.islink(
+ os.path.join(self.resultdir, f)))
+
+ def test_make_from_filename(self):
+ """Test that make from works if ResultMap has no path
+ """
results = ResultMap()
results['1000'] = S1_NAME
results['2000'] = S2_NAME
results.make_tree_from(self.sourcedir, self.resultdir)
-
sample1_dir = os.path.join(self.resultdir, S1_NAME)
sample2_dir = os.path.join(self.resultdir, S2_NAME)
self.failUnless(os.path.isdir(sample1_dir))
return suite
if __name__ == "__main__":
+ import logging
+ logging.basicConfig(level=logging.DEBUG)
from unittest2 import main
main(defaultTest='suite')