Subject: do not create dir if it exists
Description: command tries to create an output dir during tests, even if it
 already exists, raising an error. Skip creation if already present
Author: Olivier Sallou <osallou@debian.org>
Bug: 925568
Forwarded: no
Last-Updated: 2019-03-27
--- a/cnvlib/commands.py
+++ b/cnvlib/commands.py
@@ -1452,8 +1452,9 @@
                             'anti' if 'antitarget' in fname else ''))
         if args.output_dir:
             if not os.path.isdir(args.output_dir):
-                os.mkdir(args.output_dir)
-                logging.info("Created directory %s", args.output_dir)
+                if not os.path.exists(args.output_dir):
+                    os.mkdir(args.output_dir)
+                    logging.info("Created directory %s", args.output_dir)
             outfname = os.path.join(args.output_dir, outfname)
         tabio.write(garr, outfname)
 
