Create a mach target for running mozbase unittests



5 years ago
5 years ago


(Reporter: ahal, Unassigned)


Firefox Tracking Flags

(Not tracked)




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?

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.

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 variable. I don't believe the bug is filed, but we need to move that to

I've been wanting to add nose to the tree (bug 917363) and just have a 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 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.