Fix utils.copy for copying files, add unit tests

`copy('', 'a/b.ext0', 'c/d.ext1')` is copying `a/b.ext0` into `c/d.ext1/b.ext0`
(creating folder `c/d.ext1` in the process) instead of `c/d.ext1`.
Bug introduced by e03cf3f517.
This commit is contained in:
Rogdham 2013-12-07 17:35:54 +01:00
commit 7da0506f2d
2 changed files with 94 additions and 1 deletions

View file

@ -273,7 +273,7 @@ def copy(path, source, destination, destination_path=None):
destination_ = os.path.abspath(
os.path.expanduser(os.path.join(destination, destination_path)))
if not os.path.exists(destination_):
if not os.path.exists(destination_) and not os.path.isfile(source_):
os.makedirs(destination_)
def recurse(source, destination):