[Piglit] [PATCH 6/6] igt.py: Use __future__ functions, mainly print_function

Dylan Baker baker.dylan.c at gmail.com
Fri Jan 23 10:00:22 PST 2015


On Friday, January 23, 2015 17:53:29 Thomas Wood wrote:
> On 19 January 2015 at 17:38, Dylan Baker <baker.dylan.c at gmail.com> wrote:
> > This makes igt more like the rest of piglit which uses the __future__
> > version of print, division, and import
> >
> > Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> > ---
> >  tests/igt.py | 13 +++++++------
> >  1 file changed, 7 insertions(+), 6 deletions(-)
> >
> > diff --git a/tests/igt.py b/tests/igt.py
> > index 0dc6891..8d126dd 100644
> > --- a/tests/igt.py
> > +++ b/tests/igt.py
> > @@ -30,6 +30,7 @@ automatically add all tests into the 'igt' category.
> >
> >  """
> >
> > +from __future__ import print_function, division, absolute_import
> >  import os
> >  import re
> >  import sys
> > @@ -50,10 +51,10 @@ def check_environment():
> >      """
> >      debugfs_path = "/sys/kernel/debug/dri"
> >      if os.getuid() != 0:
> > -        print "Test Environment check: not root!"
> > +        print( "Test Environment check: not root!")
> 
> There's a warning from pylint here about the space after the bracket.

Yes. I'm surprised that I didn't see that. I'll fix that.

> 
> 
> >          return False
> >      if not os.path.isdir(debugfs_path):
> > -        print "Test Environment check: debugfs not mounted properly!"
> > +        print("Test Environment check: debugfs not mounted properly!")
> >          return False
> >      for subdir in os.listdir(debugfs_path):
> >          if not os.path.isdir(os.path.join(debugfs_path, subdir)):
> > @@ -61,10 +62,10 @@ def check_environment():
> >          clients = open(os.path.join(debugfs_path, subdir, "clients"), 'r')
> >          lines = clients.readlines()
> >          if len(lines) > 2:
> > -            print "Test Environment check: other drm clients running!"
> > +            print("Test Environment check: other drm clients running!")
> >              return False
> >
> > -    print "Test Environment check: Succeeded."
> > +    print("Test Environment check: Succeeded.")
> >      return True
> >
> >
> > @@ -76,7 +77,7 @@ assert os.path.exists(IGT_TEST_ROOT)
> >  # check for the test lists
> >  if not (os.path.exists(os.path.join(IGT_TEST_ROOT, 'single-tests.txt'))
> >          and os.path.exists(os.path.join(IGT_TEST_ROOT, 'multi-tests.txt'))):
> > -    print "intel-gpu-tools test lists not found."
> > +    print("intel-gpu-tools test lists not found.")
> >      sys.exit(0)
> >
> >  IGT_ENVIRONMENT_OK = check_environment()
> > @@ -150,7 +151,7 @@ def add_subtest_cases(test):
> >          return
> >
> >      if proc.returncode != 0:
> > -        print "Error: Could not list subtests for " + test
> > +        print("Error: Could not list subtests for " + test)
> >          return
> >
> >      subtests = out.split("\n")
> > --
> > 2.2.1
> >
> > _______________________________________________
> > Piglit mailing list
> > Piglit at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/piglit
-------------- 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/20150123/dc35b027/attachment.sig>


More information about the Piglit mailing list