[Webkit-unassigned] [Bug 60521] Modify jsonresults_unittest.py to use a dict format for its test data, and modify jsonresults.py to flatten hierarchical directory structures in input JSON.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue May 10 10:46:50 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=60521





--- Comment #4 from Alice Boxhall <aboxhall at chromium.org>  2011-05-10 10:46:50 PST ---
(From update of attachment 92893)
View in context: https://bugs.webkit.org/attachment.cgi?id=92893&action=review

>> Tools/TestResultServer/model/jsonresults.py:220
>> +        incremental_json = cls._flatten_json_tests(incremental_json)
> 
> Eventually, when both aggregated and incremental json are hierarchical, we probably don't want to flatten it just to unflatten it later. Can you add a FIXME to that effect?

Done.

>> Tools/TestResultServer/model/jsonresults.py:246
>> +        for (name, test) in json.iteritems():
> 
> We typically don't use parens when unpacking in other places in webkit's python code.

Ok.

>> Tools/TestResultServer/model/jsonresults.py:247
>> +            if prefix != None:
> 
> "if prefix:" is sufficient here, no?

My python-fu is weak. You are correct.

>> Tools/TestResultServer/model/jsonresults.py:248
>> +                fullname = "/".join([prefix, name])
> 
> Using join is less readable to me than just concatenating:
> fullname = prefix + "/" + name

Done.

>> Tools/TestResultServer/model/jsonresults.py:252
>> +            if re.match(".+\.html", name):
> 
> This check is not sufficiently general, e.g. some test names end in "svg". I think it would be better to avoid checking the test name and instead check if test has a "results" key.

Done.

>> Tools/TestResultServer/model/jsonresults_unittest.py:88
>> +        (builds, tests) = (test_data["builds"], test_data["tests"])
> 
> No need to do this in one line.

Done.

>> Tools/TestResultServer/model/jsonresults_unittest.py:122
>> +        if re.match(".+\.html", name):
> 
> ditto above. we should probably add a FIXME to have some tests for xhtml and svg tests.

Done.

>> Tools/TestResultServer/model/jsonresults_unittest.py:123
>> +            t = JSON_RESULTS_TESTS_TEMPLATE.replace("[TESTDATA_TEST_NAME]", name)
> 
> I know the old code did this, but webkit frowns on non-descriptive variable names. s/t/tests_dict/ ?

Done.

>> Tools/TestResultServer/model/jsonresults_unittest.py:127
>> +        else:
> 
> no need for the else since you early return from the if statement

Done.

>> Tools/TestResultServer/model/jsonresults_unittest.py:130
>> +            for (_name, _test) in sorted(test.iteritems()):
> 
> We use underscores to denote private methods/variables. This isn't needed for local variables since there is no concept of private local variables.

I was trying to come up with names that wouldn't clobber the existing name/test variables, although I agree this was not the way to do it. Changed to child_{name,test}.

>> Tools/TestResultServer/model/jsonresults_unittest.py:185
>> +                            "times": "[200,0]"}}},
> 
> this indentation is off by one space. here and a few places below. later on it's correct.

Damn, I really thought I caught all of those. Fixed.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list