From 64afff0c3e6436aeeb1630e40e47b388a9454520 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Sat, 8 Sep 2018 11:12:32 -0300 Subject: [PATCH] launcher:scenario: Fix the way we compute scenario path/name when paths supplied We were just iterating over the list without any check and could end up with a patch that was not corresponding to the actual scenario. --- validate/launcher/baseclasses.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/validate/launcher/baseclasses.py b/validate/launcher/baseclasses.py index 2b65e7e1b7..269c12e9e2 100644 --- a/validate/launcher/baseclasses.py +++ b/validate/launcher/baseclasses.py @@ -1950,15 +1950,16 @@ class ScenarioManager(Loggable): for section in config.sections(): if scenario_paths: for scenario_path in scenario_paths: - if mfile is None: - name = section - path = scenario_path - elif section in scenario_path: - # The real name of the scenario is: - # filename.REALNAME.scenario - name = scenario_path.replace(mfile + ".", "").replace( - "." + self.FILE_EXTENSION, "") - path = scenario_path + if section in os.path.splitext(os.path.basename(scenario_path))[0]: + if mfile is None: + name = section + path = scenario_path + else: + # The real name of the scenario is: + # filename.REALNAME.scenario + name = scenario_path.replace(mfile + ".", "").replace( + "." + self.FILE_EXTENSION, "") + path = scenario_path else: name = section path = None