[Piglit] [PATCH] tests/igt.py: fix various pylint warnings

Dylan Baker baker.dylan.c at gmail.com
Thu Jun 19 18:01:18 PDT 2014


Thanks for doing this Thomas.

There is only one more thing you might want to take care of, and that's 
comparisons to None. Python style is to use 'is' and 'is not' instead of '==' 
and '!=' when comparing None.

But whether you do that or not this patch is:
Reviewed-by: Dylan Baker <baker.dylan.c at gmail.com>

On Thursday, June 19, 2014 03:33:25 PM Thomas Wood wrote:
> Signed-off-by: Thomas Wood <thomas.wood at intel.com>
> ---
>  tests/igt.py | 31 ++++++++++++++-----------------
>  1 file changed, 14 insertions(+), 17 deletions(-)
> 
> diff --git a/tests/igt.py b/tests/igt.py
> index a970413..49ec64f 100644
> --- a/tests/igt.py
> +++ b/tests/igt.py
> @@ -29,10 +29,10 @@ import subprocess
>  import threading
>  import time
>  import signal
> -from datetime import datetime, timedelta
> +import errno
> +from datetime import datetime
> 
>  from os import path
> -from framework.core import TestResult
>  from framework.profile import TestProfile
>  from framework.exectest import Test, TEST_BIN_DIR
> 
> @@ -72,7 +72,7 @@ else:
>          igtTestRoot = path.join(path.realpath(path.join(TEST_BIN_DIR,
> 'igt')), 'tests')
>      else:
> -        igtTestRoot=''
> +        igtTestRoot = ''
> 
>  # check for the test lists
>  if not (os.path.exists(os.path.join(igtTestRoot, 'single-tests.txt'))
> @@ -90,12 +90,12 @@ profile = TestProfile()
>  # object is killed if the timeout is reached and it has not completed. Wait
> for # the outcome by calling the join() method from the parent.
> 
> -class ProcessTimeout (threading.Thread):
> -    def __init__ (self, timeout, proc):
> -       threading.Thread.__init__(self)
> -       self.proc = proc
> -       self.timeout = timeout
> -       self.status = 0
> +class ProcessTimeout(threading.Thread):
> +    def __init__(self, timeout, proc):
> +        threading.Thread.__init__(self)
> +        self.proc = proc
> +        self.timeout = timeout
> +        self.status = 0
> 
>      def run(self):
>          start_time = datetime.now()
> @@ -120,8 +120,8 @@ class ProcessTimeout (threading.Thread):
> 
> 
>      def join(self):
> -      threading.Thread.join(self)
> -      return self.status
> +        threading.Thread.join(self)
> +        return self.status
> 
> 
> 
> @@ -205,8 +205,6 @@ class IGTTest(Test):
> 
> 
>  def listTests(listname):
> -    oldDir = os.getcwd()
> -
>      with open(path.join(igtTestRoot, listname + '.txt'), 'r') as f:
>          lines = (line.rstrip() for line in f.readlines())
> 
> @@ -219,7 +217,7 @@ def listTests(listname):
>              break
> 
>          if "TESTLIST" in line:
> -            found_header = True;
> +            found_header = True
> 
>      return progs
> 
> @@ -230,14 +228,13 @@ for test in singleTests:
> 
>  def addSubTestCases(test):
>      proc = subprocess.Popen(
> -            [path.join(igtTestRoot, test), '--list-subtests' ],
> +            [path.join(igtTestRoot, test), '--list-subtests'],
>              stdout=subprocess.PIPE,
>              stderr=subprocess.PIPE,
>              env=os.environ.copy(),
>              universal_newlines=True
>              )
>      out, err = proc.communicate()
> -    returncode = proc.returncode
> 
>      subtests = out.split("\n")
> 
> @@ -255,4 +252,4 @@ for test in multiTests:
>  profile.dmesg = True
> 
>  # the dmesg property of TestProfile returns a Dmesg object
> -profile.dmesg.regex = re.compile("(\[drm:|drm_|intel_|i915_)")
> +profile.dmesg.regex = re.compile(r"(\[drm:|drm_|intel_|i915_)")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140619/7ff4e34c/attachment.sig>


More information about the Piglit mailing list