Closed Bug 885342 Opened 9 years ago Closed 5 months ago

Improve mozbase resolution of test dependencies


(Testing :: Mozbase, defect)

Not set


(Not tracked)



(Reporter: k0scist, Unassigned)



Some mozbase packages have tests that depend on mozbase packages
or 3rd party packages not in the package's under test
''. These probably should be listed in the package's
'tests_require' setup keyword: , if only as an
indicator to the installer that these packages are necessary.
Ideally (IMHO), the tests should be runnable with `python
test` ( ), but
this requires that `test_suite` be set for normal operation to the
string of a dot-resolvable module or that `--test-suite` be
specified.  But since our tests all live in the 'test/'
subdirectory (and not a normally importable module, basically, if
you'll accept my hand-waviness), this won't work.

A few alternatives:

- adds the test module, conditionally, to e.g. sys.path

- the test_loader keyword, ,
  could be conceivably used with a custom solution....somehow.  For
  instance, we could build a mini module just for mozbase testing.
  Or we could make the meta-package mozbase that would include this
  sort of thing and (also e.g.) be a place to consolidate things (such
  as, etc) and do project-wide sorts of things,
  typically automation for the project.  Other ideas are also

- use an off-the-shelf solution and add that to `tests_require`.  Both
  `nose` and `unittest2` can do this (Examples:

This is probably all low priority.

See Also: → 884344
See also:

The goal is to make things simpler for the cases we care about, so at worst we shouldn't make things worse wrt m-c testing, etc.  There are three steps (m-c, travis CI, currently....we don't need more, and preferably less.

Putting current tests dir as a package (eg mozfile/tests, with an file inside) may be a good idea I think. You just have then to add "test_suite='mozfile.tests'" in the file to be able to run tests with "python test", without needing unittest2 or nose.

As a bonus, it will facilitate python 3 support (if one day python 2 and 3 needs to be supported) as the directive "use_2to3" in file will then handle tests module automagically.

See for example.

I tried this with success:

cd testing/mozbase/mozfile
hg move tests mozfile
touch mozfile/tests/

rm tests # just to be sure

# edit to add "test_suite='mozfile.tests'"

python test

# ...
Ran 22 tests in 2.330s

What do you think ?
Closed: 5 months ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.