[pitivi] tests: Remove constant in runtests



commit c1f7667534727bc53dc938280809b825a4e4173a
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Sun Oct 27 05:43:41 2019 +0100

    tests: Remove constant in runtests
    
    It was called "command", but it was used as a file name with `which`.

 tests/validate-tests/runtests | 35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)
---
diff --git a/tests/validate-tests/runtests b/tests/validate-tests/runtests
index c876ac71..9ed0ca66 100755
--- a/tests/validate-tests/runtests
+++ b/tests/validate-tests/runtests
@@ -1,23 +1,28 @@
 #!/usr/bin/env python3
+# -*- coding: utf-8 -*-
 """Wrapper script for running the Pitivi integration tests."""
 import os
 import subprocess
 import sys
 
-GST_VALIDATE_LAUNCHER_COMMAND = "gst-validate-launcher"
 
-try:
-    subprocess.check_call("which %s" % GST_VALIDATE_LAUNCHER_COMMAND, shell=True)
-except subprocess.CalledProcessError as e:
-    print("ERROR: Cannot find %s: %s" % (GST_VALIDATE_LAUNCHER_COMMAND, e))
-    print("Make sure to install gst-devtools:")
-    print("    http://cgit.freedesktop.org/gstreamer/gst-devtools/tree/validate/";)
-    sys.exit(127)
+def main():
+    """Logic."""
+    try:
+        subprocess.check_call("which gst-validate-launcher", shell=True)
+    except subprocess.CalledProcessError as e:
+        print("ERROR: Cannot find gst-validate-launcher: %s" % e)
+        print("Make sure to install gst-devtools:")
+        print("    http://cgit.freedesktop.org/gstreamer/gst-devtools/tree/validate/";)
+        sys.exit(127)
 
-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, "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))
+    path = os.path.abspath(os.path.join(os.path.dirname(__file__)))
+    # Path to scan for GstValidate TestsManager subclasses.
+    os.environ["GST_VALIDATE_APPS_DIR"] = path
+    testsuite = os.path.join(path, "suite.py")
+    command = ["gst-validate-launcher", testsuite]
+    command.extend(sys.argv[1:])
+    sys.exit(subprocess.call(command))
+
+if __name__ == "__main__":
+    main()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]