Commit Graph

49 Commits

Author SHA1 Message Date
Andrew Halberstadt
1386807b19 Bug 1048446 - [python-test] Add 'sequential' key to python.ini manifests so tests can opt out of running in parallel, r=jmaher
MozReview-Commit-ID: DQWJDdU9QHO
2017-06-01 09:50:15 -04:00
Andrew Halberstadt
44dc5b30c3 Bug 1048446 - [python-test] Set up a temporary directory for tests to use, r=gbrown
We set up the temporary directory here so that it persists across multiple test invocations, as each
test is run in its own subprocess.

MozReview-Commit-ID: 7SNip54AqEI
2017-02-28 10:27:19 -05:00
Andrew Halberstadt
87d047232c Bug 1345109 - Ensure |mach python-test| errors out if no tests are found, r=mshal
Because test_objects was a generator, using it in the condition always returned True,
even if no tests were found. But extending test_objects to the manifest, converts it
to a list. So this patch simply moves the 'no tests' check a bit later on.

MozReview-Commit-ID: JpETWD1WQWH
2017-03-07 10:55:07 -05:00
Andrew Halberstadt
aac4585624 Bug 1335873 - Convert marionette harness unittests to standard python unittests, r=maja_zf
This formats the marionette-harness python tests to be a regular |mach python-test| suite. Though
we add subsuite=marionette, this is just for automation purposes. The new preferred way to run the
marionette harness tests locally is:
./mach python-test testing/marionette

They will also run if running the full suite.

The mozbase packages.txt file modifies mozlog to use 'setup.py' instead of 'pth'. The reason for
this is that the marionette-harness tests use the pytest_mozlog pytest plugin for formatting
their results (converts pytest format into something resembling the standard tbpl logging format).
In order for this plugin to get picked up however, mozlog's setup.py file needs to be processed.

MozReview-Commit-ID: Ata99evHxbd
2017-02-15 16:38:45 -05:00
Sebastian Hengst
26ea5b9d14 Backed out changeset 3c0a7527608a (bug 1335873) 2017-03-01 17:35:06 +01:00
Andrew Halberstadt
d08b8a2c05 Bug 1335873 - Convert marionette harness unittests to standard python unittests, r=maja_zf
This formats the marionette-harness python tests to be a regular |mach python-test| suite. Though
we add subsuite=marionette, this is just for automation purposes. The new preferred way to run the
marionette harness tests locally is:
./mach python-test testing/marionette

They will also run if running the full suite.

The mozbase packages.txt file modifies mozlog to use 'setup.py' instead of 'pth'. The reason for
this is that the marionette-harness tests use the pytest_mozlog pytest plugin for formatting
their results (converts pytest format into something resembling the standard tbpl logging format).
In order for this plugin to get picked up however, mozlog's setup.py file needs to be processed.

MozReview-Commit-ID: Ata99evHxbd
2017-02-15 16:38:45 -05:00
Andrew Halberstadt
873ca61ce2 Bug 1003417 - Add ability to run subsuites to |mach python-test|, r=ted
This adds the ability to use manifestparser subsuites to |mach python-test|.
Subsuites are based on the premise of a "default" set that gets run when no
subsuites are explicitly specified. When a test is labelled with a subsuite,
that test is removed from the default set and will only run if that subsuite
is explicitly specified. This will allow us to chunk python unittests out of
'make check' piecemeal. The default set will run in 'make check', and
individual tasks (e.g mozbase), will specify a subsuite explicitly.

The |mach python-test| implementation is slightly different. By default,
subsuites are not considered if developers do not pass in --subsuite. This
means running |mach python-test| without arguments will still run the full set
of tests, and similarly, passing in test paths will *just work*.

If for some reason a developer needs to actually run the default set, a special
"default" subsuite has been create, so they can use
|mach python-test --subsuite default|. This default subsuite is also what 'make
check' will explicitly invoke.

MozReview-Commit-ID: FaHb4nvuoK9
2016-11-17 16:30:33 -05:00
Mike Shal
7e8d2b63d5 Bug 1325197 - Add logging around mach python-test; r=gps
In bug 1308472 we are seeing 'make -k check' fail intermittently with
the only apparent error message something like:

make: *** [check] Error 245

This debug should make it more clear which test (if any) is responsible
for setting the return code in 'mach python-test', and whether or not
'mach python-test' is actually reaching the end of the function.

MozReview-Commit-ID: 6IQrZQqs8ij
2016-12-21 11:12:55 -05:00
Andrew Halberstadt
fd725caf73 Bug 1317970 - Filter python unittests through manifestparser.active_tests, r=chmanchester
The build system's TestResolver does a pretty good job of getting the right manifestparser
based tests to run, but it isn't perfect. Notably, it ignores the 'disabled' key. We filter
the tests through manifestparser here to make sure the build system didn't miss anything.
For context, this is also what the other test harnesses (e.g mochitest) do as well.

MozReview-Commit-ID: FaHb4nvuoK9
2016-11-17 16:30:27 -05:00
Andrew Halberstadt
7663ee0695 Bug 1317970 - Use manifestparser manifests for python unit tests, r=chmanchester
This deprecates PYTHON_UNIT_TESTS and replaces it with PYTHON_UNITTEST_MANIFESTS.
In the build system, this means python unittests will be treated the same as all
other test suites that use manifestparser. New manifests called 'python.ini' have
been created for all test directories containing python unittests.

MozReview-Commit-ID: IBHG7Thif2D
2016-11-16 09:59:22 -05:00
Andrew Halberstadt
2a88ad7d2b Bug 1309060 - Give |mach python-test| the ability to run tests in parallel, r=gps
We recently switched make check to call into |mach python-test| rather than invoking python
itself for each test file. But this ended up slowing down the tests as they were no longer
being run in parallel. This patch adds a --jobs flag to python-tests and runs test files in
parallel.

Note: if more than one job is used, output per test will be buffered and printed at the end
to avoid interleaving. This has the unfortunate side effect of making |mach python-test| look
like it is hanging, especially if running a very long file like mozbase's test.py. For this
reason, we still use -j1 by default so output will continue to be streamed. In automation we
will use multiple processes though.

MozReview-Commit-ID: 3u0wOFmyQLI
2016-10-11 12:29:09 -04:00
Anjana Vakil
da012898f8 Bug 1253359 - Use vendored Pytest in python-test and Mn harness tests r=gps
In the `python-test` mach command and the mozharness script for
the Marionette harness tests, use the vendored-in Pytest
instead of installing from pip.

Add the Marionette harness test requirements file to the
file_patterns in the definition of the marionette-harness taskcluster
job, as changes to the requirements should trigger the job to run.


MozReview-Commit-ID: J5pln2WB4GY
2016-08-05 20:10:09 +02:00
Andrew Halberstadt
0fad1a97d3 Bug 1271734 - Move all eslint related infrastructure to tools/lint, r=miker
This commit simply moves 'testing/eslint' to 'tools/lint/eslint' and the eslint related
mach command from 'python/mach_commands.py' to 'tools/lint/mach_commands.py'. It shouldn't
have any functional change on running eslint, either through mach or taskcluster.

This is in preparation for bug 1258341, to make the diffs there a little easier to read.

MozReview-Commit-ID: K03sn9lv9Lv
2016-06-02 15:38:36 -04:00
Michael Ratcliffe
957bb0b814 Bug 1273623 - Optimize eslintModuleHasIssues. r=jryans
MozReview-Commit-ID: Iu1IhDCgLJm
2016-05-18 16:45:49 +01:00
Michael Ratcliffe
f1676ddac1 Bug 1270851 - mach eslint should install eslint and their dependencies if not installed r=gps 2016-05-13 14:06:08 +01:00
Michael Ratcliffe
0dbf9a00e1 Bug 1265082 - ESLint jobs are apparently hitting the network r=me,dustin,pbro,jryans
So a few changes here:
- node_modules is downloaded using tooltool so that we dont need to rely on external infrastructure.
- We have a npm-shrinkwrap.json file that version locks all of our node packages.
- eslint, eslint-plugin-mozilla etc. are now all installed locally.

In reality this means that we don't hit the network and we don't force users into installing global packages.

./mach eslint --setup has also been improved. We install packages locally and display the path of the user's eslint binary (useful for configuring editors).

eslint-plugin-mozilla has been moved from testing/eslint-plugin-mozilla to /testing/eslint/eslint-plugin-mozilla.

The node_modules directory for eslint and other plugins is located in testing/eslint/.

MozReview-Commit-ID: 4SFSxzka6BS
2016-05-02 00:22:31 +01:00
Alexandre Poirot
f3813a20e5 Bug 1271706 - Warn when eslint is outdated. r=gps 2016-05-11 07:16:33 -07:00
J. Ryan Stinnett
9562eb1da5 Bug 1270596 - Upgrade to ESLint 2.9.0. r=ahal
MozReview-Commit-ID: IylFUWf1HVG
2016-05-06 10:41:04 -05:00
Hector Zhao
a61a5057f4 Bug 1268752 - Bug fix in locating eslint with npm. r=gps
MozReview-Commit-ID: 2020nKjC5kL
2016-04-29 10:50:40 +08:00
Bob Silverberg
2199a9f406 Bug 1263637 - Fix eslint 2 warnings for WebExtensions code. r=kmag
MozReview-Commit-ID: CNLX3xjIoNV
2016-04-18 09:08:05 -04:00
Maja Frydrychowicz
6c27872e10 Bug 1261412 - Add mach python-test option to collect tests based on path alone; r=gps
MozReview-Commit-ID: 4rsG6sMPqpv
2016-04-18 10:21:56 -04:00
Maja Frydrychowicz
56af599c3c Bug 1261412 - Relax test output requirement in mach python-test; r=gps
This accounts for default unittest and pytest output formatting,
in addition to mozunit.

MozReview-Commit-ID: 749CD0xQezX
2016-04-14 13:06:47 -04:00
Maja Frydrychowicz
6b5ab8307a Bug 1261412 - Report when mach python-test collects no tests; r=gps
MozReview-Commit-ID: GDlshUUjO7C
2016-03-22 18:53:57 -04:00
Dave Townsend
b99c8e31ad Bug 1257246: Update the version of eslint that mach installs. r=gps
MozReview-Commit-ID: mcb4QwtM96
2016-03-17 10:58:12 -07:00
Dave Townsend
ac28a6408a Bug 1262978: Run npm to get the path to installed binaries if eslint can't otherwise be found. r=gps
MozReview-Commit-ID: HFWID6QhpS2
2016-04-07 13:18:40 -07:00
Ted Mielczarek
e44beeede9 bug 1255479 - make mach python-tests use TestResolver for discovery, make mach test work for python tests. r=nalexander
MozReview-Commit-ID: CK2Vh6gdnb0
2016-03-10 12:30:10 -05:00
Patrick Brosset
e2cead3691 Bug 1248360 - Set eslint version to 1.10.3 when setting it up via mach
MozReview-Commit-ID: LmKsvGzj3fo
2016-02-16 10:01:11 +01:00
Dave Townsend
cc8a0ad5b2 Bug 1239139: Verify that a high enough node version is available before running eslint. r=gps
The most common issue I'm hearing with eslint is people who have an outdated
node installed. This does a quick check to verify the version is high enough
before linting.

MozReview-Commit-ID: Em0jn18OUYo
2016-02-09 15:34:37 -08:00
Kris Maglione
1ff52f6767 Bug 1230776: Support scripts from HTML files in eslint. r=gps
Also removes related unused variables in mach_commands.py.
2015-12-05 13:17:49 -08:00
Felipe Gomes
6af4297229 Bug 1231720 - Log when ESLint finishes running. r=nalexander 2015-12-10 14:31:14 -05:00
Dave Townsend
7b284baa81 Bug 1230300: Fix mach eslint to pass command arguments through to eslint. r=gps
Currently mach treats the first argument to eslint as the path and moves it to
the end of the arguments but this breaks usage like "mach eslint -f json browser".

It used to be necessary to change to the directory you wanted to lint but now
the .eslintignore is at the top level we just run from the top level. This means
the path argument doesn't need to be special anymore.
2015-12-03 10:38:29 -08:00
Dave Townsend
07937b2d92 Bug 1229858: Add a preprocessor to convert XBL into JavaScript blocks for eslint. r=miker 2015-12-02 17:03:33 -08:00
Jared Wein
c8aa983c2d Bug 1229154 - Launch 'eslint' with UNIX environment since 'eslint' is not a valid Win32 binary. r=gps 2015-12-01 14:29:47 -05:00
Dave Townsend
8ccbdf748e Bug 1228628: Move all eslintignore rules to the top-level of the tree. r=mconley 2015-11-27 09:39:59 -08:00
Michael Ratcliffe
87f5d15814 Bug 1212047 - Improve ESLint logging in case of error r=glandium
Fix *all* return codes
2015-10-23 17:18:45 +01:00
Michael Ratcliffe
079442b68d Bug 1211223 - Error running eslint setup on Windows r=mh+mozilla, r=pbro 2015-10-23 14:36:24 +01:00
Michael Ratcliffe
a638984ea2 Bug 1203520 - We need a DevTools ESLint plugin containing our ruleset r=gps 2015-09-30 14:44:48 +01:00
Nick Alexander
eaebad76b9 Bug 1177933 - Add |mach eslint| command. r=mcomella,dmose
DONTBUILD NPOTB
2015-07-02 12:18:52 -07:00
Gregory Szorc
d848d6eb6d Bug 1176642 - Defer import of glob; r=glandium
This was the only import of glob from all mach_commands.py files. Kill
it.

With this commit, there are no modules imported by a single
mach_commands.py outside of testing/web-platform/mach_commands.py.
2015-06-25 12:11:55 -07:00
Gregory Szorc
d993a444fa Bug 1176642 - Use absolute_import in mach_commands.py files; r=glandium
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.
2015-06-21 17:39:09 -07:00
Gregory Szorc
0222a3a19c Bug 1176642 - Remove unused imports; r=glandium 2015-06-25 12:16:38 -07:00
Mike Hommey
2e51d2ef87 Bug 1147283 - Replace mozpack.path with mozpath. r=mshal
Back when mozpack.path was added, it was used as:

  import mozpack.path
  mozpack.path.func()

Nowadays, the common idiom is:

  import mozpack.path as mozpath
  mozpath.func()

because it's shorter.

$ git grep mozpath\\. | wc -l
423
$ git grep mozpack.path\\. | wc -l
123

This change was done with:
$ git grep -l mozpack.path\\. | xargs sed -i 's/mozpack\.path\./mozpath./g'
$ git grep -l 'import mozpack.path$' | xargs sed -i 's/import mozpack.path$/\0 as mozpath/'
$ (pat='import mozpack.path as mozpath'; git grep -l "$pat" | xargs sed -i "1,/$pat/b;/$pat/d")
2015-03-27 08:13:16 +09:00
Mike Hommey
711c2629f1 Bug 1076649 - Remove the '+' prefixing from mach commands with allow_all_arguments=True. r=gps
The reason to use '+' prefixing was to distinguish between options to the
mach command itself, and options that are passed down to whatever the
command does (like mach run passing down args to the built application).
That makes things unnecessarily awkward, and quite non-standard.

Instead, use standard '-' prefixing, and pass all the unknown arguments
down. If there is overlap between the known arguments and arguments supported
by the underlying tool (like -remote when using mach run), it is possible to
use '--' to mark all following arguments as being targetted at the underlying
tool.

For instance:
    mach run -- -remote something
would run
    firefox -remote something
while
    mach run -remote something
would run
    firefox something

As allow_all_arguments is redundant with the presence of a argparse.REMAINDER
CommandArgument, allow_all_arguments is removed. The only mach command with a
argparse.REMAINDER CommandArgument without allow_all_arguments was "mach dmd",
and it did so because it didn't want to use '+' prefixes.
2014-10-07 07:36:27 +09:00
Nathan Froyd
febf1acc75 Bug 1062518 - ensure that |mach python-test| considers $PWD when finding tests; r=mshal 2014-09-15 13:25:41 -04:00
Nathan Froyd
8746cb9bdd Bug 1056862 - make |mach python-test| work even if run from outside the srcdir; r=gps
DONTBUILD because NPOTB
2014-08-21 11:03:26 -04:00
Gregory Szorc
06057dce2d Bug 952280 - mach python commands now use virtualenv APIs; r=mshal
The Python-related mach commands were written before we had a virtualenv
API exposed to the mach command context. This patch updates those
commands to use the newer APIs. As a bonus, these commands now work
without running configure!
2013-12-19 13:48:37 -08:00
Mike Hommey
fdd78e61e4 Bug 905490 - Avoid "mach python" logging the python command. r=gps 2013-08-15 23:45:09 +09:00
Matt Brubeck
6e471bfa49 Bug 899695 - Fix exception in "mach python" on Windows [r=gps]
DONTBUILD (not part of the build)
2013-08-08 08:06:02 -07:00
Nick Alexander
8f0c16b5e3 Bug 818744 - mach commands to run Python and Python unit tests. r=gps
DONTBUILD because NPOTB
2013-07-02 17:33:48 -07:00