[Piglit] [Patch v2 6/8] igt.py: add docstrings.

Ian Romanick idr at freedesktop.org
Mon Jan 26 13:41:26 PST 2015


On 01/26/2015 11:28 AM, Dylan Baker wrote:
> In some cases this is really just about formatting.
> 
> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> ---
>  tests/igt.py | 24 ++++++++++++++++--------
>  1 file changed, 16 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/igt.py b/tests/igt.py
> index b7ee165..4a46fb0 100644
> --- a/tests/igt.py
> +++ b/tests/igt.py
> @@ -22,6 +22,14 @@
>  # OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
>  # DEALINGS IN THE SOFTWARE.
>  
> +"""IGTTest: Execute an intel-gpu-tools test.
> +
> +To use this, create an igt symlink in piglit/bin which points to the root
> +of the intel-gpu-tools sources with the compiled tests. Piglit will
> +automatically add all tests into the 'igt' category.
> +
> +"""

Is the extra blank line in the docstring required by PEP?

> +
>  import os
>  import re
>  import sys
> @@ -33,16 +41,14 @@ from framework.profile import TestProfile, Test
>  
>  __all__ = ['profile']
>  
> -#############################################################################
> -##### IGTTest: Execute an intel-gpu-tools test
> -#####
> -##### To use this, create an igt symlink in piglit/bin which points to the root
> -##### of the intel-gpu-tools sources with the compiled tests. Piglit will
> -##### automatically add all tests into the 'igt' category.
> -#############################################################################
>  
>  
>  def check_environment():
> +    """Check that the environment that piglit is running in is appropraite.
> +
> +    IGT requires root, debugfs to be mounted, and to be the only drm client.
> +
> +    """
>      debugfs_path = "/sys/kernel/debug/dri"
>      if os.getuid() != 0:
>          print "Test Environment check: not root!"
> @@ -77,11 +83,11 @@ if not (os.path.exists(os.path.join(IGT_TEST_ROOT, 'single-tests.txt'))
>      sys.exit(0)
>  
>  IGT_ENVIRONMENT_OK = check_environment()
> -
>  profile = TestProfile()  # pylint: disable=invalid-name
>  
>  
>  class IGTTest(Test):
> +    """Test class for running libdrm."""
>      def __init__(self, binary, arguments=None):
>          if arguments is None:
>              arguments = []
> @@ -112,6 +118,7 @@ class IGTTest(Test):
>  
>  
>  def list_tests(listname):
> +    """Parse igt test list and return them as a list."""
>      with open(os.path.join(IGT_TEST_ROOT, listname + '.txt'), 'r') as f:
>          lines = (line.rstrip() for line in f.readlines())
>  
> @@ -130,6 +137,7 @@ def list_tests(listname):
>  
>  
>  def add_subtest_cases(test):
> +    """Get subtest instances."""
>      proc = subprocess.Popen(
>          [os.path.join(IGT_TEST_ROOT, test), '--list-subtests'],
>          stdout=subprocess.PIPE,
> 



More information about the Piglit mailing list