ietf-tools / bibxml-service

Django-based Web service implementing IETF BibXML APIs
https://bib.ietf.org
BSD 3-Clause "New" or "Revised" License
17 stars 19 forks source link

test: Improve test coverage of serializers #439

Closed microamp closed 4 months ago

microamp commented 4 months ago
python -m coverage report

before vs after:

Name                                                                                Stmts   Miss  Cover
-------------------------------------------------------------------------------------------------------
98,101c98,101
< xml2rfc_compat/serializers/anchor.py                                                 22      2    91%
< xml2rfc_compat/serializers/authors.py                                                71     15    79%
< xml2rfc_compat/serializers/reference.py                                              92      7    92%
< xml2rfc_compat/serializers/series.py                                                 38      2    95%
---
> xml2rfc_compat/serializers/anchor.py                                                 22      0   100%
> xml2rfc_compat/serializers/authors.py                                                71      0   100%
> xml2rfc_compat/serializers/reference.py                                              92      2    98%
> xml2rfc_compat/serializers/series.py                                                 38      0   100%
106c106
< xml2rfc_compat/tests/test_serializers.py                                            314      9    97%
---
> xml2rfc_compat/tests/test_serializers.py                                            374      0   100%
110c110
< TOTAL                                                                              4105   1335    67%
---
> TOTAL                                                                              4165   1302    69%
microamp commented 4 months ago

How to view the HTML coverage report locally:

  1. Run

    SNAPSHOT=$(git describe --abbrev=0) docker compose -f docker-compose.test.yml \
            -f docker-compose.test-local-interactive.yml up --build
  2. From another shell session, run

    SNAPSHOT=$(git describe --abbrev=0) docker compose -f docker-compose.test.yml \
            -f docker-compose.test-local-interactive.yml exec test bash
    python -m coverage run manage.py test && python -m coverage report && python -m coverage html
  3. View the HTML report on your host machine.

    (cd htmlcov && python -m http.server)