Closed Bug 1436802 Opened 2 years ago Closed 2 years ago

Create python unittests (or cramtests) for lint implementations

Categories

(Firefox Build System :: Lint and Formatting, enhancement, P3)

enhancement

Tracking

(firefox61 fixed)

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: ahal, Assigned: ahal)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

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.
Product: Testing → Firefox Build System
Assignee: nobody → ahalberstadt
Status: NEW → ASSIGNED
Here's pytest's documentation on fixtures in case it helps to understand this review:
https://docs.pytest.org/en/latest/fixture.html
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 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+
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.
Pushed by ahalberstadt@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ad34ac3d45a6
[lint] Add some tests for the flake8 linter integration r=andi
https://hg.mozilla.org/mozilla-central/rev/ad34ac3d45a6
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
Version: Version 3 → 3 Branch
Version: 3 Branch → unspecified
You need to log in before you can comment on or make changes to this bug.