Commit Graph

7 Commits

Author SHA1 Message Date
Marti Bolivar d7df27c370 configuration: allow callers to specify west topdir
Add a topdir argument to each of these functions:

- read_config()
- update_config()
- delete_config()

If set, then topdir/.west/config will be used as the local
configuration file if necessary. This allows users of this module to
decouple themselves from west.util.west_dir() without having to resort
to temporarily setting environment variables.

Keep the tests up to date, adding a couple of test cases to make sure
the new kwarg works as expected.

While we're here, re-work the fixture setup so we don't ever have to
monkey-patch west.configuration._location() by always pointing the
WEST_CONFIG_xxx environment variables inside the tmpdir we're running
each test case from. This lets us avoid some extra work in tox.ini and
makes the resulting test code easier to read, without sacrificing any
safety in terms of touching the user's actual files.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-08-30 17:32:57 -06: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
Torsten Rasmussen 397bc5bac0 command: Added `west config` command for handling of west config files
Fixes: #198 #213

This commit add the command `west config` for getting and setting of
key - value pairs in:
- Project specific: `<project>/.west/config`
- Global specific: `~/.westconfig`
- System specific, Linux:`/etc/westconfig`
                   MacOS: `/usr/local/etc/westconfig`
                   Windows: `%PROGRAMDATA%/west/config`
It also includes corresponding test cases.

Signed-off-by: Torsten Rasmussen <torsten.rasmussen@nordicsemi.no>
2019-03-11 14:59:26 -06:00
Carles Cufi 22b395c75c tox: Fix .ini file on macOS
sys.platform returns "darwin" on macOS. Fix the .ini file so that tests
actually run on macOS.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-02-16 08:06:25 -07:00
Marti Bolivar 673563e0bb Add another directory to flake8 exclude
When running flake8, we should also be ignoring the build directory.

Signed-off-by: Marti Bolivar <marti@foundries.io>
2019-02-05 20:21:08 +01:00
Marti Bolivar 6ce01bd857 tests: call flake8 from tox
Add a flake8 configuration to the tox testing. This enforces a
consistent style. Clean up remaining issues around the codebase.

Disable a handful of flake8's complaints when the style seems popular
enough among the team members to ignore.

Signed-off-by: Marti Bolivar <marti@foundries.io>
2019-01-09 11:21:05 -07:00
Marti Bolivar 18060dd02a tests: use tox and overhaul project testing
To properly test the project commands, it would be best to have a
fresh west bootstrapper package created and installed on PATH, so it
could be used to run commands exactly as they'd happen if we package
and ship the working tree.

To make that easier, add a dependency on tox and use it for testing:

https://tox.readthedocs.io/en/latest/

From now on, we'll test west by running 'tox' from the repository
root.  This has several advantages over running pytest directly:

- "Just run tox": there are no longer any differences in test invocation
  between POSIX OSes and Windows.

- tox creates an sdist package of the current tree using our setup.py
  and installs it into a new virtual environment, then runs tests
  there.  This removes interference from other packages installed on
  the host (like released bootstrappers that are also installed)

- we get to run multiple shell commands in order, should that ever be needed,
  in our test procedures in a way that won't affect users

With that done, we can re-work the multirepo command testing to invoke
the bootstrapper in the virtual environment, adding various tests and
filling in longstanding testing gaps by adding increased checking of
the results (currently, much of the testing just checks whether
commands do or do not error out, which isn't enough).

These changes were made with a view towards the upcoming changes which
are planned before releasing west "into the wild": the test case code
should be mostly the same before and after the changes, so this serves
as a good baseline against regressions introduced by those upcoming
changes.

Signed-off-by: Marti Bolivar <marti@foundries.io>

[wip] debugging shippable results

Signed-off-by: Marti Bolivar <marti@foundries.io>

[wip] just test one py3

shutil.which west is picking up a 3.4 version in the 3.6 test, oddly

Signed-off-by: Marti Bolivar <marti@foundries.io>
2019-01-09 11:21:05 -07:00