Create python unittests (or cramtests) for lint implementations

RESOLVED FIXED in Firefox 61

Status

enhancement
P3
normal
RESOLVED FIXED
Last year
6 months ago

People

(Reporter: ahal, Assigned: ahal)

Tracking

(Blocks 1 bug)

3 Branch
mozilla61
Dependency tree / graph

Firefox Tracking Flags

(firefox61 fixed)

Details

Attachments

(1 attachment)

Mozlint itself has pretty good test coverage, but the lint implementations (that live under tools/lint) don't. They do tend to be fairly simple, but there has been a few bugs that could have been caught by tests (or for which we could have added a test).

Let's stand up some basic tests so there's at least a place to expand upon.

Updated

Last year
Product: Testing → Firefox Build System
Assignee

Updated

Last year
Assignee: nobody → ahalberstadt
Status: NEW → ASSIGNED
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)
Assignee

Comment 3

Last year
Here's pytest's documentation on fixtures in case it helps to understand this review:
https://docs.pytest.org/en/latest/fixture.html

Comment 4

Last year
mozreview-review
Comment on attachment 8961824 [details]
Bug 1436802 - [lint] Add some tests for the flake8 linter integration

https://reviewboard.mozilla.org/r/230640/#review237580

::: tools/lint/test/test_flake8.py:3
(Diff revision 1)
> +# This Source Code Form is subject to the terms of the Mozilla Public
> +# License, v. 2.0. If a copy of the MPL was not distributed with this
> +# file, You can obtain one at http://mozilla.org/MPL/2.0/.

Nit: I believe that test files should be in the public domain. https://www.mozilla.org/en-US/MPL/license-policy/ indicates that you can use a license header like this:

```
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
```

(The same probably applies to `tools/lint/test/conftest.py` as well.)
See Also: → 1449638

Comment 5

Last year
mozreview-review
Comment on attachment 8961824 [details]
Bug 1436802 - [lint] Add some tests for the flake8 linter integration

https://reviewboard.mozilla.org/r/230640/#review237888
Attachment #8961824 - Flags: review?(bpostelnicu) → review+
Assignee

Comment 6

Last year
mozreview-review-reply
Comment on attachment 8961824 [details]
Bug 1436802 - [lint] Add some tests for the flake8 linter integration

https://reviewboard.mozilla.org/r/230640/#review237580

> Nit: I believe that test files should be in the public domain. https://www.mozilla.org/en-US/MPL/license-policy/ indicates that you can use a license header like this:
> 
> ```
> # Any copyright is dedicated to the Public Domain.
> # http://creativecommons.org/publicdomain/zero/1.0/
> ```
> 
> (The same probably applies to `tools/lint/test/conftest.py` as well.)

Ah, interesting I hadn't noticed that before! I think almost all of our test code is MPLv2 but might as well start licensing under CC. Looks like by leaving off a license it also defaults to CC, so maybe I'll just do that.
Comment hidden (mozreview-request)

Comment 8

Last year
Pushed by ahalberstadt@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ad34ac3d45a6
[lint] Add some tests for the flake8 linter integration r=andi

Comment 9

Last year
bugherder
https://hg.mozilla.org/mozilla-central/rev/ad34ac3d45a6
Status: ASSIGNED → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
Version: Version 3 → 3 Branch
You need to log in before you can comment on or make changes to this bug.