2021-02-10 08:38:33 +08:00
|
|
|
# Benefits of using tox:
|
|
|
|
#
|
|
|
|
# 1. makes sure we are testing west as installed by setup.py
|
|
|
|
# 2. avoid touching user global / system config files
|
|
|
|
# 3. avoid touching any git repositories outside of tmpdirs
|
|
|
|
# 4. ensure global / system config settings have no effect on the tests
|
|
|
|
|
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-05 05:41:24 +08:00
|
|
|
[tox]
|
2020-08-29 02:12:44 +08:00
|
|
|
envlist=py3
|
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-05 05:41:24 +08:00
|
|
|
|
2019-01-09 05:07:46 +08:00
|
|
|
[flake8]
|
|
|
|
# We explicitly disable the following errors:
|
|
|
|
#
|
|
|
|
# - E126: continuation line over-indented for hanging indent
|
|
|
|
# - E261: at least two spaces before inline comment
|
|
|
|
# - E302: expected 2 blank lines, found 1
|
2019-10-11 08:04:23 +08:00
|
|
|
# - E305: expected 2 blank lines after class or function definition, found 1
|
2019-01-09 05:07:46 +08:00
|
|
|
# - W504: line break after binary operator
|
2019-10-11 08:04:23 +08:00
|
|
|
ignore = E126,E261,E302,E305,W504
|
2024-07-17 17:50:24 +08:00
|
|
|
# Don't lint setup.py, the .tox or python virtualenv directory, or the build directory
|
|
|
|
exclude = setup.py,.tox,.venv,build
|
2023-09-02 01:43:50 +08:00
|
|
|
max-line-length = 100
|
2019-01-09 05:07:46 +08:00
|
|
|
|
2020-05-29 18:05:19 +08:00
|
|
|
[mypy]
|
|
|
|
mypy_path=src
|
|
|
|
ignore_missing_imports=True
|
|
|
|
|
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-05 05:41:24 +08:00
|
|
|
[testenv]
|
2020-08-15 04:48:02 +08:00
|
|
|
deps =
|
|
|
|
setuptools-scm
|
|
|
|
pytest
|
|
|
|
pytest-cov
|
2021-06-23 13:03:26 +08:00
|
|
|
types-PyYAML
|
2020-08-15 04:48:02 +08:00
|
|
|
flake8
|
|
|
|
mypy
|
2019-02-22 00:52:04 +08:00
|
|
|
setenv =
|
2024-08-29 03:08:47 +08:00
|
|
|
# For instance: ./.tox/py3/tmp/
|
2019-02-22 00:52:04 +08:00
|
|
|
TOXTEMPDIR={envtmpdir}
|
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-05 05:41:24 +08:00
|
|
|
commands =
|
2023-09-28 03:51:36 +08:00
|
|
|
python -m pytest --cov-report=html --cov=west {posargs:tests} --basetemp='{envtmpdir}/pytest with space/'
|
2024-08-29 03:08:47 +08:00
|
|
|
python -m flake8 --config='{toxinidir}'/tox.ini '{toxinidir}'
|
|
|
|
python -m mypy --config-file='{toxinidir}'/tox.ini --package=west
|