Commit d6d8f355 authored by Thibault Saunier's avatar Thibault Saunier 🌵
Browse files

validate: Let testsuites define scenarios path

The code was not taking into account the fact that testsuite could be
located in a different folder that the default one.

Now the testsuite is responsible for providing a path if it wants
to set extra scenarios or the user can set one by hand.
parent fd029e12
...@@ -280,9 +280,7 @@ Available options:""") ...@@ -280,9 +280,7 @@ Available options:""")
"ges-projects"), "ges-projects"),
help="Paths in which to look for moved medias") help="Paths in which to look for moved medias")
group.add_argument("--ges-scenario-paths", dest="scenarios_path", group.add_argument("--ges-scenario-paths", dest="scenarios_path",
default=os.path.join(utils.DEFAULT_GST_QA_ASSETS, default=None,
help="Paths in which to look for moved medias") help="Paths in which to look for moved medias")
group.add_argument("-r", "--disable-recurse-paths", dest="disable_recurse", group.add_argument("-r", "--disable-recurse-paths", dest="disable_recurse",
default=False, action="store_true", default=False, action="store_true",
...@@ -300,7 +298,7 @@ Available options:""") ...@@ -300,7 +298,7 @@ Available options:""")
def list_tests(self): def list_tests(self):
return self.tests return self.tests
def register_defaults(self, project_paths=None): def register_defaults(self, project_paths=None, scenarios_path=None):
projects = list() projects = list()
all_scenarios = list() all_scenarios = list()
if not self.args: if not self.args:
...@@ -315,11 +313,15 @@ Available options:""") ...@@ -315,11 +313,15 @@ Available options:""")
continue continue
projects.append(utils.path2url(os.path.join(path, root, f))) projects.append(utils.path2url(os.path.join(path, root, f)))
for root, dirs, files in os.walk(self.options.scenarios_path): if self.options.scenarios_path:
for f in files: scenarios_path = self.options.scenarios_path
if not f.endswith(".scenario"):
continue if scenarios_path:
all_scenarios.append(os.path.join(root, f)) for root, dirs, files in os.walk(scenarios_path):
for f in files:
if not f.endswith(".scenario"):
all_scenarios.append(os.path.join(root, f))
else: else:
for proj_uri in self.args: for proj_uri in self.args:
if not utils.isuri(proj_uri): if not utils.isuri(proj_uri):
...@@ -364,9 +366,10 @@ Available options:""") ...@@ -364,9 +366,10 @@ Available options:""")
self.reporter, project, self.reporter, project,
combination=comb) combination=comb)
) )
for scenario in self._scenarios.discover_scenarios(all_scenarios): if all_scenarios:
classname = "scenario.%s" % for scenario in self._scenarios.discover_scenarios(all_scenarios):
self.add_test(GESScenarioTest(classname, classname = "scenario.%s" %
self.options, self.add_test(GESScenarioTest(classname,
self.reporter, self.options,
scenario=scenario)) self.reporter,
\ No newline at end of file scenario=scenario))
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment