Commit Graph

14 Commits

Author SHA1 Message Date
Martí Bolívar 11b4606a0b tests: improve west.manifest coverage
Add additional line coverage for manifest.py using output from pycov.

I'm pretty happy with the resulting level of statement coverage (94%)
and the number of bugs that got shaken out by writing these (5 real
ones along with a couple of other improvements).

The remaining 6% is mostly trivial or part of the unimplemented
functions needed to import maps. The trivial stuff can get addressed
some other day if we're interested in getting to 100%, but I think
it's time to move on to implementing map imports after this, now that
we've got better test coverage for the manifest API in general and its
basic import feature in particular.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-01-17 12:47:54 -08:00
Martí Bolívar e8fafed5cd tree-wide: add python file copyright headers
And update a couple.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-01-17 17:14:36 +01:00
Martí Bolívar 28e35f0705 tree-wide: rename "installation" to "workspace"
The term "west installation" is inaccurate since 0.6, since we no longer
clone west into .west/west.

The term "workspace" is more familiar and seems to be more readily
understood, so switch to that instead. Keep backwards compatibility
with the requires_installation kwarg and attribute to WestCommand for
now.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-01-17 09:44:36 +01:00
Martí Bolívar 47b5f710e0 tree-wide: use f-strings more, tweak logs
Use f-strings instead of str.format() or string concatenation with +
whenever practical. Tweak a few log messages while we're here.

I may be getting a little f-string-happy, but I think having a single,
consistent style throughout the code base makes things easier to read,
and f-strings look like the natural default choice to me.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-01-16 09:18:30 -08:00
Martí Bolívar 6bb4247e12 tests: add regression tests for tag revisions
Add a remote repository to the setup we create in conftest.py whose
revision is a tag. Add testing for it in project.py, generalizing
update_helper() a bit while doing this to keep the code readable.

This adds coverage for basic west operations when manifest projects
have revisions which are tags.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-01-14 09:46:07 -08:00
Marti Bolivar 44faeaa3de commands: fix project clone with --clone-depth
Add a mandatory space between shell arguments. Fix the test cases so
they actually test this as advertised.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-10-02 09:10:28 -06:00
Marti Bolivar f511662b4c tests: tweak extension command in conftest
Adjust the name of the extension command provided in the test
environment, along with some related identifiers, so they're easier to
grep for. Make the help in the yaml file consistent with the python file.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-09-06 12:39:52 -06:00
Marti Bolivar 46ca8354bd conftest.py: add license/copyright header
This was missing.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-05-30 11:39:05 -06:00
Marti Bolivar b94b71bbfa tests: allow cmd() to use non-standard environment
We'll use this the next patch. It's useful for isolation, because the
environment is one of the things that does live on between tests.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-05-30 11:39:05 -06:00
Marti Bolivar a2ae763750 tests: fix misleading conftest.py comment
We don't have west in repos_tmpdir. This is yet another old docstring
that I forgot to update when we removed the bootstrapper.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-05-30 11:39:05 -06:00
Marti 624880e8ff tests: conftest: use command strings exactly on Windows
This fixes test_project.py::test_list on Windows, as otherwise quoting
and splitting the relevant paths using shlex with POSIX rules behaves
incorrectly.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-05-20 11:06:53 +02:00
Marti Bolivar 1c6d0d3dcb tests: fixture setup optimizations
It takes 20 seconds on my machine to run the full set of tests, which
is slow enough that testing breaks me out of flow state.

On the suspicion that creating git repositories and using the file://
protocol when cloning (which prevents use of hardlinks) is slowing
things down, use some pytest features to avoid creating git
repositories repeatedly. Also let git use hardlinks when they are
available when cloning repositories.

On my system, this brings the average of 10 runs from 20.129 seconds
spent testing to 17.649, a 12% improvement overall. Still not ideal,
but not worth throwing away, either.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-05-20 11:06:53 +02:00
Marti Bolivar adf7e5bd2c tests: don't test pre-unification features
Don't copy the west tree; tox already installs it for us into the new
virtualenv, and we don't run any code out of a checked out repository
anymore, so doing things related to that is unnecessary.

This also makes the tests run a little bit faster (around a 5% or more
speedup on my system).

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-05-20 11:06:53 +02:00
Marti Bolivar e19e7e61b5 tests: flatten the hierarchy
There's no good reason to have these tests in subdirectories. Flatten
them out. Keep the directory of invalid manifests separate to keep the
directory listing clean, though.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-05-20 11:06:53 +02:00