Browse Source

Fix config file exception (#3533)

String formatting in the Exception constructor doesn't work.. leads to:

```
Traceback (most recent call last):
  File "/FrameworkBenchmarks/toolset/run-tests.py", line 253, in <module>
    sys.exit(main())
  File "/FrameworkBenchmarks/toolset/run-tests.py", line 214, in main
    results = Results(config)
  File "/FrameworkBenchmarks/toolset/utils/results_helper.py", line 52, in __init__
    t.name for t in gather_remaining_tests(self.config, self)
  File "/FrameworkBenchmarks/toolset/utils/metadata_helper.py", line 131, in gather_remaining_tests
    return gather_tests(config.test, config.exclude, config, results)
  File "/FrameworkBenchmarks/toolset/utils/metadata_helper.py", line 95, in gather_tests
    "Error loading '{!s}'.".format(config_file_name))
```

Added a log and color
Nate 7 years ago
parent
commit
4a32e6e7df
1 changed files with 4 additions and 2 deletions
  1. 4 2
      toolset/utils/metadata_helper.py

+ 4 - 2
toolset/utils/metadata_helper.py

@@ -5,6 +5,7 @@ import json
 from collections import OrderedDict
 
 from toolset.utils.output_helper import log
+from colorama import Fore
 
 
 def gather_langauges(benchmarker_config):
@@ -88,8 +89,9 @@ def gather_tests(include=[], exclude=[], benchmarker_config=None,
             try:
                 config = json.load(config_file)
             except ValueError:
-                raise Exception(
-                    "Error loading '{!s}'.".format(config_file_name))
+                log("Error loading config: {!s}".format(config_file_name),
+                    color=Fore.RED)
+                raise Exception("Error loading config file")
 
         # Find all tests in the config file
         config_tests = parse_config(config, os.path.dirname(config_file_name),