Closed Bug 1397852 Opened 4 years ago Closed 4 years ago

Enable flake8 linter on testing/xpcshell


(Testing :: XPCShell Harness, enhancement)

Not set


(firefox57 fixed)

Tracking Status
firefox57 --- fixed


(Reporter: ahal, Assigned: stevea1, Mentored)


(Whiteboard: [good-first-bug])


(1 file)

To enable this, add 'testing/xpcshell' to the include list in:

Then run:
./mach lint -l flake8 testing/xpcshell

All the errors will also need to be fixed. If desired, you could look into using the autopep8 module to do this automatically (just be sure to set max-line-length to 99 if you do this).

Be sure to run:
./mach lint --outgoing
./mach python-test testing/xpcshell

to make sure nothing broke.
Assignee: nobody → stevea1
I've cleaned up all the flake8 errors in the xpcshell files. The python-test ran succesfully.
Comment on attachment 8908120 [details]
Bug 1397852 - Enable flake8 linter on testing/xpcshell.

Thanks, this was really well done. I have few very minor things I'd like you to fix up, once you've pushed a change with these I'll run it through the tests as usual.

::: testing/xpcshell/
(Diff revision 1)
> -                ['-e', 'const _SERVER_ADDR = "localhost"',
> +                          '-e', 'const _SERVER_ADDR = "localhost"',
> -                 '-e', 'const _HEAD_FILES = [%s];' % cmdH,
> +                          '-e', 'const _HEAD_FILES = [%s];' % cmdH,
> -                 '-e', 'const _JSDEBUGGER_PORT = %d;' % dbgport,
> +                          '-e', 'const _JSDEBUGGER_PORT = %d;' % dbgport,

This looks a bit weird, try indenting it four spaces past the return:

    return xpcscmd + [
        '-e', '...',
        '-e', '...',

::: testing/xpcshell/
(Diff revision 1)
> -          These 3 variables depend on input from the command line and we need to allow for absolute paths.
> +          These 3 variables depend on input from the command line and we need to allow
> +          for absolute paths.
>            This function is overloaded for a remote solution as os.path* won't work remotely.

Please reformat this last line to be part of the above paragraph.

::: testing/xpcshell/
(Diff revision 1)
>                  test = testClass(test_object,
> -                        verbose=self.verbose or test_object.get("verbose") == "true",
> +                                 verbose=self.verbose or
> +                                 test_object.get("verbose") == "true",
> -                        usingTSan=usingTSan,
> +                                 usingTSan=usingTSan,
> -                        mobileArgs=mobileArgs, **kwargs)
> +                                 mobileArgs=mobileArgs, **kwargs)

This works, but I'm not crazy about the condition being split across two lines. Try something like:

    test = testClase(
        verbose=self.verbose or test_object.get(...

::: testing/xpcshell/
(Diff revision 1)
>"INFO | Passed: %d" % self.passCount)
>"INFO | Failed: %d" % self.failCount)
>"INFO | Todo: %d" % self.todoCount)
>"INFO | Retried: %d" % len(self.try_again_list))
> -        if gotSIGINT and not keepGoing:
> +        if gotSIGINT and not keep_going:

Nice, looks like you found + fixed a legit bug!
Attachment #8908120 - Flags: review?(ahalberstadt) → review+
Ok, I tweaked the formatting for those 3 items. And, yes, the keepGoing thing surprised me when I realized the code could never have worked as written, but I was able to sort out what the original developer intended and fix it. So that was cool.
Pushed by
Enable flake8 linter on testing/xpcshell. r=ahal
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.