[pitivi] validate: Rename some files and add comments
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] validate: Rename some files and add comments
- Date: Wed, 9 Nov 2016 13:13:58 +0000 (UTC)
commit 9665a08e801a90f90ce33e74a4a1af6e558b5ad6
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Thu Oct 27 00:58:30 2016 +0200
validate: Rename some files and add comments
Reviewed-by: Thibault Saunier <tsaunier gnome org>
Differential Revision: https://phabricator.freedesktop.org/D1429
pre-commit.hook | 4 +-
.../{pitivivalidate.py => manager.py} | 28 ++++++++++++--------
tests/validate-tests/runtests | 2 +-
tests/validate-tests/{pitivi.py => suite.py} | 3 ++
4 files changed, 23 insertions(+), 14 deletions(-)
---
diff --git a/pre-commit.hook b/pre-commit.hook
index 312d340..f89e5aa 100755
--- a/pre-commit.hook
+++ b/pre-commit.hook
@@ -70,8 +70,8 @@ tests/test_undo_timeline.py
tests/test_utils.py
tests/test_utils_timeline.py
tests/test_widgets.py
-tests/validate-tests/pitivi.py
-tests/validate-tests/pitivivalidate.py
+tests/validate-tests/manager.py
+tests/validate-tests/suite.py
win32/configure.py
win32/pitivi
"
diff --git a/tests/validate-tests/pitivivalidate.py b/tests/validate-tests/manager.py
similarity index 80%
rename from tests/validate-tests/pitivivalidate.py
rename to tests/validate-tests/manager.py
index d09032b..10edfc3 100644
--- a/tests/validate-tests/pitivivalidate.py
+++ b/tests/validate-tests/manager.py
@@ -17,6 +17,7 @@
# License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301, USA.
+"""The Pitivi GstValidate tests manager and friends."""
import os
from urllib import unquote
@@ -26,13 +27,9 @@ from baseclasses import GstValidateTest
from baseclasses import ScenarioManager
from baseclasses import TestsManager
-Pitivi_DURATION_TOLERANCE = utils.GST_SECOND / 2
-
def quote_uri(uri):
- """
- Encode a URI/path according to RFC 2396, without touching the file:/// part.
- """
+ """Encodes a URI/path according to RFC 2396."""
# Split off the "file:///" part, if present.
parts = urlparse.urlsplit(uri, allow_fragments=False)
# Make absolutely sure the string is unquoted before quoting again!
@@ -41,6 +38,7 @@ def quote_uri(uri):
class PitiviTest(GstValidateTest):
+ """A scenario to be run as a test."""
def __init__(self, executable, classname, options, reporter, scenario):
super(PitiviTest, self).__init__(executable, classname, options, reporter,
@@ -48,6 +46,7 @@ class PitiviTest(GstValidateTest):
self._scenario = scenario
def set_sample_paths(self):
+ """Passes the media paths as optional flags."""
paths = self.options.paths
if not isinstance(paths, list):
@@ -59,26 +58,29 @@ class PitiviTest(GstValidateTest):
self.add_arguments("--ges-sample-path-recurse", quote_uri(path))
def build_arguments(self):
+ """Prepares the arguments for the executable used to run the test."""
GstValidateTest.build_arguments(self)
self.set_sample_paths()
+ # Pass the path to the scenario file as a positional argument.
self.add_arguments(self._scenario.path)
class PitiviTestsManager(TestsManager):
+
name = "pitivi"
+ """The name identifying this test manager class."""
_scenarios = ScenarioManager()
- def __init__(self):
- super(PitiviTestsManager, self).__init__()
-
def init(self):
+ """Initializes the manager."""
self.fixme("Implement init checking")
return True
def add_options(self, parser):
+ """Adds options to the specified ArgumentParser."""
group = parser.add_argument_group("Pitivi specific option group"
" and behaviours",
description="")
@@ -89,8 +91,9 @@ class PitiviTestsManager(TestsManager):
help="Paths in which to look for scenario files")
def set_settings(self, options, args, reporter):
+ """Configures the manager based on the specified options."""
TestsManager.set_settings(self, options, args, reporter)
- self._scenarios.config = self.options
+ PitiviTestsManager._scenarios.config = self.options
try:
os.makedirs(utils.url2path(options.dest)[0])
@@ -98,19 +101,22 @@ class PitiviTestsManager(TestsManager):
pass
def list_tests(self):
+ """Lists the tests in the order they have been added."""
return self.tests
def find_scenarios(self):
+ """Yields paths to the found scenario files."""
for path in self.options.pitivi_scenario_paths:
- for root, dirs, files in os.walk(path):
+ for root, unused_dirs, files in os.walk(path):
for file in files:
if not file.endswith(".scenario"):
continue
yield os.path.join(path, root, file)
def register_defaults(self):
+ """Adds the available scenario files as tests."""
for scenario_name in self.find_scenarios():
- scenario = self._scenarios.get_scenario(scenario_name)
+ scenario = PitiviTestsManager._scenarios.get_scenario(scenario_name)
if scenario is None:
continue
diff --git a/tests/validate-tests/runtests b/tests/validate-tests/runtests
index e42fb65..8204856 100755
--- a/tests/validate-tests/runtests
+++ b/tests/validate-tests/runtests
@@ -19,7 +19,7 @@ except subprocess.CalledProcessError as e:
path = os.path.abspath(os.path.join(os.path.dirname(__file__))) # pylint: disable=invalid-name
# Path to scan for GstValidate TestsManager subclasses.
os.environ["GST_VALIDATE_APPS_DIR"] = path
-testsuite = os.path.join(path, "pitivi.py") # pylint: disable=invalid-name
+testsuite = os.path.join(path, "suite.py") # pylint: disable=invalid-name
command = [GST_VALIDATE_LAUNCHER_COMMAND, testsuite] # pylint: disable=invalid-name
command.extend(sys.argv[1:])
sys.exit(subprocess.call(command))
diff --git a/tests/validate-tests/pitivi.py b/tests/validate-tests/suite.py
similarity index 90%
rename from tests/validate-tests/pitivi.py
rename to tests/validate-tests/suite.py
index a0a88be..e0fbf2d 100644
--- a/tests/validate-tests/pitivi.py
+++ b/tests/validate-tests/suite.py
@@ -21,14 +21,17 @@
import os
+# Instruct GstValidate to use the test manager with name == "pitivi".
TEST_MANAGER = "pitivi"
def setup_tests(test_manager, options):
+ """Sets up the specified test manager."""
path = os.path.abspath(os.path.dirname(__file__))
print("Setting up Pitivi integration tests in %s" % path)
options.pitivi_scenario_paths = [os.path.join(path, "scenarios")]
options.add_paths(os.path.join(path, os.path.pardir, "samples"))
options.pitivi_executable = os.path.join(path, "..", "..", "bin", "pitivi")
test_manager.register_defaults()
+ # Everything went fine.
return True
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]