Skip to content

Commit

Permalink
Add review remarks.
Browse files Browse the repository at this point in the history
  • Loading branch information
Spacetown committed Dec 14, 2021
1 parent d09397e commit e5d8d58
Show file tree
Hide file tree
Showing 7 changed files with 154 additions and 153 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/deploy.yml
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Run release_checklist
run: |
admin/release_checklist 5.0
deploy:
runs-on: ubuntu-18.04
needs: release-check
Expand All @@ -47,16 +47,16 @@ jobs:
python -m pip install nox
- name: Lint with flake8
run: |
python -m nox --non-interactive --session lint
nox --non-interactive --session lint
- name: Test with pytest
run: |
python -m nox --non-interactive --session "tests_version($CC)"
nox --non-interactive --session "tests_compiler($CC)"
- name: Generate documentation
run: |
python -m nox --non-interactive --session doc
nox --non-interactive --session doc
- name: Build
run: |
python -m nox --non-interactive --session build_wheel
nox --non-interactive --session build_wheel
- name: Upload distribution
if: ${{ success() }}
uses: actions/upload-artifact@v2
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/test.yml
Expand Up @@ -105,7 +105,6 @@ jobs:
- name: Setup environment
run: |
echo "USE_COVERAGE=${{ ( ( matrix.os == 'windows-2019' ) && ( matrix.python-version == '3.7' ) ) || ( ( matrix.os == 'ubuntu-18.04' ) && ( matrix.gcc == 'gcc-6' ) && ( matrix.python-version == '3.8' ) ) }}" >> $GITHUB_ENV
echo "TEST_OPTS=--archive_differences" >> $GITHUB_ENV
shell: bash
- name: Install msys with GCC (Windows)
if: ${{ startsWith(matrix.os,'windows-') }}
Expand Down Expand Up @@ -134,16 +133,16 @@ jobs:
python3 -m pip install nox codecov
- name: Lint files
run: |
python3 -m nox --non-interactive --session lint
nox --non-interactive --session lint
- name: Check format of files
if: ${{ ( matrix.python-version != 'pypy3' ) }}
# Currently fail of this job is OK.
continue-on-error: true
run: |
python -m nox --non-interactive --session black
nox --non-interactive --session black
- name: Test with pytest
run: |
python -m nox --non-interactive --session "tests_version(${{ matrix.gcc }})"
nox --non-interactive --session "tests_compiler(${{ matrix.gcc }})" -- --archive_differences
- name: Upload pytest test results
if: ${{ failure() }}
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -174,10 +173,10 @@ jobs:
- uses: actions/checkout@v2
- name: Build Docker
run: |
python3 -m nox --non-interactive --session "docker_qa_build_version(${{ matrix.gcc }})"
python3 -m nox --non-interactive --session "docker_qa_build_compiler(${{ matrix.gcc }})"
- name: Run Docker
run: |
python3 -m nox --non-interactive --session "docker_qa_run_version(${{ matrix.gcc }})"
python3 -m nox --non-interactive --session "docker_qa_run_compiler(${{ matrix.gcc }})"
- name: Upload pytest test results
if: ${{ failure() }}
uses: actions/upload-artifact@v2
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -34,6 +34,8 @@ gcovr-*/

# VS Code
.vscode
*.code-workspace

# PyCharm
.idea

37 changes: 16 additions & 21 deletions CONTRIBUTING.rst
Expand Up @@ -243,7 +243,10 @@ The QA process (``python3 -m nox``) consists of multiple parts:
- documentation build (``python3 -m nox --session doc``)

The tests are in the ``gcovr/tests`` directory.
You can run the tests with ``python3 -m nox --session tests_version($CC)``.
You can run the tests with ``python3 -m nox --session tests``
for the default GCC version (used from environment ``CC``iv availabele, else gcc-5.
You can also select the gcc version if you run the tests with e.g.
``python3 -m nox --session tests_compiler(gcc-8)``.

There are unit tests for some parts of gcovr,
and a comprehensive corpus of example projects
Expand Down Expand Up @@ -305,54 +308,47 @@ and have set up a :ref:`development environment <development environment>`.
You can select a different GCC version by setting the CC environment variable.
Supported versions are ``CC=gcc-5``, ``CC=gcc-6``, ``CC=gcc-8`` and ``clang-10``.

You can run the tests with additional options by setting the environment variable
``TEST_OPTS``. Run all tests after each change is a bit slow, therefore you can
You can run the tests with additional options by adding ``--`` and then the options
to the test invocation. Run all tests after each change is a bit slow, therefore you can
limit the tests to a specific test file, example project, or output format.
For example:

.. code:: bash
# run only XML tests
export TEST_OPTS="-k 'xml'"
python3 -m nox --session tests
python3 -m nox --session tests -- -k 'xml'
# run the simple1 tests
export TEST_OPTS="-k 'simple1'"
python3 -m nox --session tests
python3 -m nox --session tests -- -k 'simple1'
# run the simple1 tests only for XML
export TEST_OPTS="-k 'xml and simple1'"
python3 -m nox --session tests
python3 -m nox --session tests -- -k 'xml and simple1'
To see which tests would be run, add the ``--collect-only`` option:

.. code:: bash
#see which tests would be run
export TEST_OPTS="--collect-only"
python3 -m nox --session tests
python3 -m nox --session tests -- --collect-only
Sometimes during development you need to create reference files for new test
or update the current reference files. To do this you have to
add ``--generate_reference`` or ``--update-reference`` option
to the ``TEST_OPTS`` variable.
to the test invocation.
By default generated output files are automatically removed after test run.
To skip this process you can add ``--skip_clean`` option the ``TEST_OPTS``.
To skip this process you can add ``--skip_clean`` option the test invocation.
For example:

.. code:: bash
# run tests and generate references for simple1 example
export TEST_OPTS="-k 'simple1' --generate_reference"
python3 -m nox --session tests
python3 -m nox --session tests -- -k 'simple1' --generate_reference
# run tests and update xml references for simple1 example
export TEST_OPTS="-k 'xml and simple1' --update_reference"
python3 -m nox --session tests
python3 -m nox --session tests -- -k 'xml and simple1' --update_reference
# run only XML tests and do not remove generated files
export TEST_OPTS="-k 'xml' --skip_clean"
python3 -m nox --session tests
python3 -m nox --session tests -- -k 'xml' --skip_clean
When the currently generated output reports differ to the reference files
you can create a ZIP archive named ``diff.zip`` in the tests directory
Expand All @@ -363,8 +359,7 @@ with the differences as an artifact.
.. code:: bash
# run tests and generate a ZIP archive when there were differences
export TEST_OPTS="--archive_differences"
python3 -m nox --session tests
python3 -m nox --session tests -- --archive_differences
.. versionchanged:: NEXT
Change how to start test from ``make test`` to ``python3 -m nox --session test``
Expand Down
6 changes: 3 additions & 3 deletions admin/Dockerfile.qa
Expand Up @@ -27,6 +27,6 @@ USER docker:docker
# Unicode is necessary for some tools like "black" to work.
ENV LC_ALL=C.UTF-8 LANG=C.UTF-8

CMD ( echo docker | sudo -S -p "Running chmod with sudo" chown -R docker:docker /gcovr ) && \
echo "" && \
python3 -m nox --non-interactive
CMD ( echo docker | sudo -S -p "Running chmod with sudo..." chown -R docker:docker /gcovr/gcovr ) && \
echo "\ndone\nStarting test..." && \
python3 -m nox --envdir /tmp/envs --non-interactive
4 changes: 4 additions & 0 deletions doc/requirements.txt
@@ -0,0 +1,4 @@
sphinx
sphinx_rtd_theme
sphinxcontrib-autoprogram == 0.1.5 ; python_version == "3.6"
sphinxcontrib-autoprogram >= 0.1.5 ; python_version >= "3.7"

0 comments on commit e5d8d58

Please sign in to comment.