Mozlog currently has two implementations. The top level package is based on the logging module and is
deprecated. The newer structured logging implementation lives in mozlog.structured. This patch swaps the
two, so the top level mozlog module contains the recommended implementation, while mozlog.unstructured
contains the old one.
This removes ambiguity as to which modules are being imported, making
import slightly faster as Python doesn't need to test so many
directories for file presence.
All files should already be using absolute imports because mach command
modules aren't imported to the package they belong to: they instead
belong to the "mach" package. So relative imports shouldn't have been
used.
There's a test for add_task() in selftest.py called ADD_TASK_MULTIPLE, which tests if
multiple add_task() tests are working. The test added in this commit does the exact same
except without run_test(). Since the original tests included this, I thought it would make
a good case for checking if the removal of run_test() is working as expected. Please remove
if this is unnecessary.
Since the simple test cases before this bug had cases for both passing and
failing, it would be a good idea to follow suit and add similar failing tests
for when run_test() is omitted.
Like the other simple tests defined in selftest.py, SIMPLE_FAILING_TEST,
ADD_TEST_FAILING, etc., it follows a similar pattern except these are done
without run_test() defined.
Four new test cases have been added to testing/xpcshell/selftest.py.
These new tests check that tests where run_test() is not defined
work properly.
The test cases check the following cases:
1. when only add_test() is used.
2. when only add_task() is used.
3. when both add_task() and add_test() is used.
4. when a test file is empty, i.e. contains no add_test(), add_task() or
run_test().
Test bodies only consist of do_check_true(true) calls to make up a minimal
test without run_test() in the same vein as the other simple tests defined
previously.
Also, broke a comment up that was too long.
As referenced in Bug 982852, this fix makes run_tests() optional.
Test cases can now consist of add_test() and add_task() calls
without the need to exclusively set up a run_test() just to call
run_next_test() inside it. If run_test() however is defined, it
will be called directly as usual, which should keep all older
tests working without breaking.
Since most run_test() calls right now are mostly boilerplate and
usually are of the form -- function run_test(){run_next_test();} --
this fix checks if run_test is defined by using the typeof operator
which should evaluate to "function" if it is defined. If defined,
it is called straight away, otherwise, run_next_test() is called,
which is what run_test() usually does when used as a set up to
call tests registered by add_test() and add_task().
This is for aurora (dev edition) compatibility. In this channel, there is a
selected lightweight theme by default. Tests don't expect this to be the case
so this simply resets the relevant prefs for mochitests and xpcshell tests.