Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • willsalmon/buildstream
  • CumHoleZH/buildstream
  • tchaik/buildstream
  • DCotyPortfolio/buildstream
  • jesusoctavioas/buildstream
  • patrickmmartin/buildstream
  • franred/buildstream
  • tintou/buildstream
  • alatiera/buildstream
  • martinblanchard/buildstream
  • neverdie22042524/buildstream
  • Mattlk13/buildstream
  • PServers/buildstream
  • phamnghia610909/buildstream
  • chiaratolentino/buildstream
  • eysz7-x-x/buildstream
  • kerrick1/buildstream
  • matthew-yates/buildstream
  • twofeathers/buildstream
  • mhadjimichael/buildstream
  • pointswaves/buildstream
  • Mr.JackWilson/buildstream
  • Tw3akG33k/buildstream
  • AlexFazakas/buildstream
  • eruidfkiy/buildstream
  • clamotion2/buildstream
  • nanonyme/buildstream
  • wickyjaaa/buildstream
  • nmanchev/buildstream
  • bojorquez.ja/buildstream
  • mostynb/buildstream
  • highpit74/buildstream
  • Demo112/buildstream
  • ba2014sheer/buildstream
  • tonimadrino/buildstream
  • usuario2o/buildstream
  • Angelika123456/buildstream
  • neo355/buildstream
  • corentin-ferlay/buildstream
  • coldtom/buildstream
  • wifitvbox81/buildstream
  • 358253885/buildstream
  • seanborg/buildstream
  • SotK/buildstream
  • DouglasWinship/buildstream
  • karansthr97/buildstream
  • louib/buildstream
  • bwh-ct/buildstream
  • robjh/buildstream
  • we88c0de/buildstream
  • zhengxian5555/buildstream
51 results
Show changes
Commits on Source (3)
  • Tristan Van Berkom's avatar
    Support running test environments in parallel with `detox` · d7c87f80
    Tristan Van Berkom authored
    This patch namespaces the test temp directory and the output
    coverage report file with the name of the environment under test,
    such that separately run tests do not access the same files.
    
    When running tests without tox, directly through setup.py,
    then the tmp directory will still be `./tmp`.
    
      * .gitignore: Added new .coverage-reports/ directory
    
      * .gitlab-ci.yml: Rely on tox to combine and report coverage, only
        tell tox about the COVERAGE_PREFIX so that results can be namespaced
        by CI job name.
    
        This change also publishes the sources and final combined `.coverage`
        file in an output gitlab artifact for inspection, and lists some missing
        dependencies to the `coverage` job.
    
      * tox.ini: Add comments and refactor main [testenv] section so that
        other environments dont inherit too much unrelated cruft.
    
        Set a separate working directory for each test environment,
        solving the parallelism concerns about coverage raised in #844.
    
        Also implemented new `tox -e coverage` environment to combine
        any found coverage and print a report.
    
    Fixes issue #844
    d7c87f80
  • Tristan Van Berkom's avatar
    CONTRIBUTING.rst: Updated to mention new `coverage` tox environment. · 44d900f5
    Tristan Van Berkom authored
    Also point out that it is possible to run test environments in
    parallel using the `detox` tool.
    44d900f5
  • Tristan Van Berkom's avatar
    Testing without the chdir · e496ee4c
    Tristan Van Berkom authored
    e496ee4c
......@@ -13,11 +13,12 @@ tests/**/*.pyc
integration-cache/
tmp
.coverage
.coverage-reports/
.coverage.*
.cache
.pytest_cache/
*.bst/
.tox
.tox/
# Pycache, in case buildstream is ran directly from within the source
# tree
......
......@@ -13,6 +13,7 @@ variables:
PYTEST_ADDOPTS: "--color=yes"
INTEGRATION_CACHE: "${CI_PROJECT_DIR}/cache/integration-cache"
TEST_COMMAND: "tox -- --color=yes --integration"
COVERAGE_PREFIX: "${CI_JOB_NAME}."
#####################################################
......@@ -24,9 +25,6 @@ variables:
.tests-template: &tests
stage: test
variables:
COVERAGE_DIR: coverage-linux
before_script:
# Diagnostics
- mount
......@@ -40,14 +38,11 @@ variables:
- su buildstream -c "${TEST_COMMAND}"
after_script:
# Collect our reports
- mkdir -p ${COVERAGE_DIR}
- cp .coverage ${COVERAGE_DIR}/coverage."${CI_JOB_NAME}"
except:
- schedules
artifacts:
paths:
- ${COVERAGE_DIR}
- .coverage-reports
tests-debian-9:
image: buildstream/testsuite-debian:9-5da27168-32c47d1c
......@@ -83,7 +78,6 @@ tests-unix:
<<: *tests
variables:
BST_FORCE_BACKEND: "unix"
COVERAGE_DIR: coverage-unix
script:
......@@ -239,22 +233,22 @@ coverage:
stage: post
coverage: '/TOTAL +\d+ +\d+ +(\d+\.\d+)%/'
script:
- pip3 install -r requirements/requirements.txt -r requirements/dev-requirements.txt
- pip3 install --no-index .
- mkdir report
- cd report
- cp ../coverage-unix/coverage.* .
- cp ../coverage-linux/coverage.* .
- ls coverage.*
- coverage combine --rcfile=../.coveragerc -a coverage.*
- coverage report --rcfile=../.coveragerc -m
- cp -a .coverage-reports/ ./coverage-sources
- tox -e coverage
- cp -a .coverage-reports/ ./coverage-report
dependencies:
- tests-debian-9
- tests-fedora-27
- tests-fedora-28
- tests-fedora-missing-deps
- tests-ubuntu-18.04
- tests-unix
except:
- schedules
artifacts:
paths:
- coverage-sources/
- coverage-report/
# Deploy, only for merges which land on master branch.
#
......
......@@ -1498,6 +1498,10 @@ option when running tox::
tox -e py37
If you do have multiple python versions installed and would like to test against
multiple versions, then we recommend using `detox <https://github.com/tox-dev/detox>`_,
just run it with the same arguments you would give `tox`.
Linting is performed separately from testing. In order to run the linting step which
consists of running the ``pycodestyle`` and ``pylint`` tools, run the following::
......@@ -1574,6 +1578,19 @@ can run ``tox`` with ``-r`` or ``--recreate`` option.
./setup.py test --addopts 'tests/frontend/buildtrack.py::test_build_track'
Observing coverage
~~~~~~~~~~~~~~~~~~
Once you have run the tests using `tox` (or `detox`), some coverage reports will
have been left behind.
To view the coverage report of the last test run, simply run::
tox -e coverage
This will collate any reports from separate python environments that may be
under test before displaying the combined coverage.
Adding tests
~~~~~~~~~~~~
Tests are found in the tests subdirectory, inside of which
......
#
# Tox global configuration
#
[tox]
envlist = py35,py36,py37
skip_missing_interpreters = true
#
# Defaults for all environments
#
# Anything specified here is iherited by the sections
#
[testenv]
commands = pytest {posargs}
commands =
pytest --basetemp {envtmpdir} {posargs} {toxinidir}
mkdir -p {toxinidir}/.coverage-reports
deps =
-rrequirements/requirements.txt
-rrequirements/dev-requirements.txt
......@@ -13,6 +23,32 @@ passenv =
GI_TYPELIB_PATH
INTEGRATION_CACHE
#
# These keys are not inherited by any other sections
#
setenv =
py{35,36,37}: COVERAGE_FILE = .coverage.{env:COVERAGE_PREFIX:}{envname}
whitelist_externals =
py{35,36,37}:
cp
mkdir
#
# Coverage reporting
#
[testenv:coverage]
commands =
- coverage combine --rcfile={toxinidir}/.coveragerc {toxinidir}/.coverage-reports/
coverage report --rcfile={toxinidir}/.coveragerc -m
deps =
-rrequirements/requirements.txt
-rrequirements/dev-requirements.txt
setenv =
COVERAGE_FILE = {toxinidir}/.coverage-reports/.coverage
#
# Running linters
#
[testenv:lint]
commands =
pycodestyle
......@@ -22,6 +58,9 @@ deps =
-rrequirements/dev-requirements.txt
-rrequirements/plugin-requirements.txt
#
# Building documentation
#
[testenv:docs]
commands =
make -C doc
......