Create a mach target for running mozbase unittests

NEW
Unassigned

Status

5 years ago
5 years ago

People

(Reporter: ahal, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
Now that mozbase is moving to m-c, it should be as easy as possible to run its unittests.
Maybe just a "mach python-test" command that runs  PYTHON_UNIT_TESTS, and add them to that?
Wouldn't it be too general? We also have Python unit tests for marionette, which you might not want to execute. Not sure if we can be more granular with an option to that mach command.
Oh, how do we run the unit tests for the other test suites which live in m-c?
(Reporter)

Comment 4

5 years ago
There already is a python-test command.. not sure if it runs everything in PYTHON_UNIT_TESTS or not. I could certainly add them to that, though imo the downside is that people won't know that mozbase tests are incorporated there.
I think we need a seperate command just to run the mozbase unit tests. I don't want to have to explain that 75% (or whatever) of the output of running "mach python-test" is not relevant to a new mozbase contributor. The code required to support this should be very minimal.
(Reporter)

Comment 6

5 years ago
If the purpose of the python-test command is to run all known python unittests, then we could add them there *and* create a separate target.
I figured it would be `mach python-test testing/mozbase`. I'm open to having a special command for it if that makes life simpler though.
We currently define Python unit tests in a Makefile.in variable. I don't believe the bug is filed, but we need to move that to moz.build.

I've been wanting to add nose to the tree (bug 917363) and just have a moz.build mechanism for passing discovery options into nose's API. We should be able to define whole directories to scan for tests and nose's discovery mechanism should do the right thing.

Once that's all in place, the |mach python-tests| command can just hook up to moz.build scan results to find relevant Python test files.
Duplicate of this bug: 1068128
There is some interest in also using this to allow coverage reporting, see bug 1067696 and bug 1068128.
You need to log in before you can comment on or make changes to this bug.