[Piglit] [PATCH v2] junit.py: Fix handling of special test names.

Jose Fonseca jfonseca at vmware.com
Mon Feb 23 11:18:06 PST 2015


Looks great. Thanks for the update.

Jose

On 23/02/15 19:02, Mark Janes wrote:
> In junit.py, the testname variable is used by a closure within the
> write_test() scope.  Modifying it breaks the filtering of expected
> failures.
>
> v2: to improve readability, use a different variable for the
>      `testname + self._test_suffix` sub-expression. (thanks to Jose)
> ---
>   framework/backends/junit.py | 10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/framework/backends/junit.py b/framework/backends/junit.py
> index ddaf826..82f9c29 100644
> --- a/framework/backends/junit.py
> +++ b/framework/backends/junit.py
> @@ -166,16 +166,18 @@ class JUnitBackend(FileBackend):
>           # set different root names.
>           classname = 'piglit.' + classname
>
> -        testname += self._test_suffix
> -
>           # Jenkins will display special pages when the test has certain names.
>           # https://urldefense.proofpoint.com/v2/url?u=https-3A__jenkins-2Dci.org_issue_18062&d=AwIBAg&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=sT2YF7CGaimaln02GHLrz9tFlWKKR2mHz34AUYCBTsQ&s=CtRXWpX5XLWElHRFgx4NrASGuM-iWvFeRX5DAgiiNN0&e=
>           # https://urldefense.proofpoint.com/v2/url?u=https-3A__jenkins-2Dci.org_issue_19810&d=AwIBAg&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=sT2YF7CGaimaln02GHLrz9tFlWKKR2mHz34AUYCBTsQ&s=6rPmO533z_y3PNFAsq6q9TrpPy-aq2J9adzAYAQspZY&e=
> -        if testname in ('api', 'search'):
> +        # The testname variable is used in the calculate_result
> +        # closure, and must not have the suffix appended.
> +        full_test_name = testname + self._test_suffix
> +        if full_test_name in ('api', 'search'):
>               testname += '_'
> +            full_test_name = testname + self._test_suffix
>
>           # Create the root element
> -        element = etree.Element('testcase', name=testname,
> +        element = etree.Element('testcase', name=full_test_name,
>                                   classname=classname,
>                                   time=str(data['time']),
>                                   status=str(data['result']))
>



More information about the Piglit mailing list