From 500f74be9bac673e9c4dc9ebd50cd3b273a9acb0 2013-07-31 01:48:28 From: Paul Ivanov Date: 2013-07-31 01:48:28 Subject: [PATCH] simplified copy_files logic --- diff --git a/IPython/nbconvert/tests/base.py b/IPython/nbconvert/tests/base.py index e12a31d..0ed75e4 100644 --- a/IPython/nbconvert/tests/base.py +++ b/IPython/nbconvert/tests/base.py @@ -108,18 +108,14 @@ class TestsBase(object): return temp_dir - def copy_files_to(self, copy_filenames=None, destination=None): - - #Copy test files into the destination directory. - if copy_filenames: - for pattern in copy_filenames: - for match in glob.glob(os.path.join(self._get_files_path(), pattern)): - if destination is None: - shutil.copyfile(match, os.path.basename(match)) - else: - if not os.path.isdir(destination): - os.makedirs(destination) - shutil.copyfile(match, os.path.join(destination, os.path.basename(match))) + def copy_files_to(self, copy_filenames, dest='.'): + "Copy test files into the destination directory" + if not os.path.isdir(dest): + os.makedirs(dest) + files_path = self._get_files_path() + for pattern in copy_filenames: + for match in glob.glob(os.path.join(files_path, pattern)): + shutil.copyfile(match, os.path.join(dest, os.path.basename(match))) def _get_files_path(self):