summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--framework/core.py4
-rw-r--r--framework/programs/summary.py8
-rw-r--r--unittests/core_tests.py2
3 files changed, 9 insertions, 5 deletions
diff --git a/framework/core.py b/framework/core.py
index a75e59868..d052bd524 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -120,9 +120,7 @@ def checkDir(dirname, failifexists):
os.stat(dirname)
except OSError as e:
if e.errno not in [errno.ENOENT, errno.ENOTDIR] and failifexists:
- raise exceptions.PiglitFatalError(
- "%(dirname)s exists already.\nUse --overwrite if "
- "you want to overwrite it.\n" % locals())
+ raise exceptions.PiglitException
try:
if not os.path.exists(dirname):
diff --git a/framework/programs/summary.py b/framework/programs/summary.py
index b42675f22..13368e4fe 100644
--- a/framework/programs/summary.py
+++ b/framework/programs/summary.py
@@ -101,7 +101,13 @@ def html(input_):
shutil.rmtree(args.summaryDir)
# If the requested directory doesn't exist, create it or throw an error
- core.checkDir(args.summaryDir, not args.overwrite)
+ try:
+ core.checkDir(args.summaryDir, not args.overwrite)
+ except exceptions.PiglitException:
+ raise exceptions.PiglitFatalError(
+ '{} already exists.\n'
+ 'use -o/--overwrite if you want to overwrite it.'.format(
+ args.summaryDir))
# Merge args.list and args.resultsFiles
if args.list:
diff --git a/unittests/core_tests.py b/unittests/core_tests.py
index 043440b47..e1523363f 100644
--- a/unittests/core_tests.py
+++ b/unittests/core_tests.py
@@ -278,7 +278,7 @@ class TestPiglitConfig(object):
@utils.capture_stderr
-@nt.raises(exceptions.PiglitFatalError)
+@nt.raises(exceptions.PiglitException)
def test_check_dir_exists_fail():
"""core.check_dir: if the directory exists and failifexsits is True fail"""
with mock.patch('framework.core.os.stat', mock.Mock(side_effect=OSError)):