Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make sure that coverage.xml includes file path prefix #140

Merged
merged 15 commits into from
Apr 18, 2022

Conversation

gro1m
Copy link
Contributor

@gro1m gro1m commented Mar 21, 2022

  • move pytest section from setup.cfg to pytest.ini
  • fix coverage by not using pytest-cov
  • pin pytest v7 in test-requirements

@gro1m gro1m changed the title [Draft] move pytest section from setup.cfg to tox.ini move pytest section from setup.cfg to tox.ini Mar 21, 2022
@aconrad
Copy link
Owner

aconrad commented Mar 22, 2022

Hi @gro1m, thanks for trying to get this to work! I checked out your branch and ran it locally, and the coverage still generates filename without pycobertura/ as prefix, and I'm still getting the same warning:

CoverageWarning: --include is ignored because --source is set (include-ignored)

Can you get it to work? What commands are you running?

I don't know why this is happening, and unless you do, we might need to reach out to the coveragepy folks about it. My Google searches weren't fruitful and all I get to is the official docs that mention:

Warnings

...

  • “–include is ignored because –source is set (include-ignored)”
    Both --include and --source were specified while running code. Both are meant to focus measurement on a particular part of your source code, so --include is ignored in favor of --source.

Source: https://coverage.readthedocs.io/en/coverage-4.5.1x/cmd.html#warnings

@gro1m
Copy link
Contributor Author

gro1m commented Mar 22, 2022

Hi @aconrad

It has to work - there are no warnings anymore :)

(base) $ git branch
  feature/add-regex
* feature/cleanup-source-and-include
  feature/hideable-columns
  master
(base) $ conda activate py39
(py39) $ conda list
# packages in environment at ~/opt/anaconda3/envs/py39:
#
# Name                    Version                   Build  Channel
attrs                     21.4.0                   pypi_0    pypi
black                     21.12b0                  pypi_0    pypi
bleach                    4.1.0                    pypi_0    pypi
build                     0.7.0                    pypi_0    pypi
ca-certificates           2021.10.26           hecd8cb5_2  
certifi                   2021.10.8        py39hecd8cb5_0  
charset-normalizer        2.0.7                    pypi_0    pypi
click                     8.0.3                    pypi_0    pypi
colorama                  0.4.4                    pypi_0    pypi
coverage                  6.3.2                    pypi_0    pypi
distlib                   0.3.4                    pypi_0    pypi
docutils                  0.18                     pypi_0    pypi
filelock                  3.4.2                    pypi_0    pypi
idna                      3.3                      pypi_0    pypi
importlib-metadata        4.8.2                    pypi_0    pypi
iniconfig                 1.1.1                    pypi_0    pypi
jinja2                    3.0.3                    pypi_0    pypi
keyring                   23.2.1                   pypi_0    pypi
libcxx                    12.0.0               h2f01273_0  
libffi                    3.3                  hb1e8313_2  
lxml                      4.7.1                    pypi_0    pypi
markupsafe                2.0.1                    pypi_0    pypi
mock                      4.0.3                    pypi_0    pypi
mypy-extensions           0.4.3                    pypi_0    pypi
ncurses                   6.3                  hca72f7f_2  
openssl                   1.1.1l               h9ed2024_0  
packaging                 21.3                     pypi_0    pypi
pathspec                  0.9.0                    pypi_0    pypi
pep517                    0.12.0                   pypi_0    pypi
pip                       21.2.4           py39hecd8cb5_0  
pkginfo                   1.8.1                    pypi_0    pypi
pluggy                    1.0.0                    pypi_0    pypi
py                        1.11.0                   pypi_0    pypi
pycobertura               2.1.0                     dev_0    <develop>
pygments                  2.10.0                   pypi_0    pypi
pyparsing                 3.0.6                    pypi_0    pypi
pytest                    7.1.1                    pypi_0    pypi
pytest-cov                3.0.0                    pypi_0    pypi
python                    3.9.7                h88f2d9e_1  
readline                  8.1                  h9ed2024_0  
readme-renderer           30.0                     pypi_0    pypi
requests                  2.26.0                   pypi_0    pypi
requests-toolbelt         0.9.1                    pypi_0    pypi
rfc3986                   1.5.0                    pypi_0    pypi
ruamel-yaml               0.17.21                  pypi_0    pypi
ruamel-yaml-clib          0.2.6                    pypi_0    pypi
setuptools                58.0.4           py39hecd8cb5_0  
six                       1.16.0                   pypi_0    pypi
sqlite                    3.36.0               hce871da_0  
tabulate                  0.8.9                    pypi_0    pypi
tk                        8.6.11               h7bc2e8c_0  
tomli                     1.2.2                    pypi_0    pypi
tox                       3.24.5                   pypi_0    pypi
tqdm                      4.62.3                   pypi_0    pypi
twine                     3.6.0                    pypi_0    pypi
tzdata                    2021e                hda174b7_0  
urllib3                   1.26.7                   pypi_0    pypi
virtualenv                20.13.0                  pypi_0    pypi
webencodings              0.5.1                    pypi_0    pypi
wheel                     0.37.0             pyhd3eb1b0_1  
xz                        5.2.5                h1de35cc_0  
zipp                      3.6.0                    pypi_0    pypi
zlib                      1.2.11               h1de35cc_3  
(py39) $ pycobertura show coverage.xml
Filename                 Stmts    Miss  Cover    Missing
---------------------  -------  ------  -------  ---------
__init__.py                  2       0  100.00%
cli.py                      78       0  100.00%
cobertura.py               206       0  100.00%
filesystem.py               87       0  100.00%
reporters.py               192       0  100.00%
utils.py                   118       1  99.15%   38
templates/__init__.py        0       0  100.00%
templates/filters.py        12       0  100.00%
TOTAL                      695       1  99.86%
(py39) $ pytest
============================================================================================= test session starts ==============================================================================================
platform darwin -- Python 3.9.7, pytest-7.1.1, pluggy-1.0.0 -- ~/opt/anaconda3/envs/py39/bin/python
cachedir: .pytest_cache
rootdir: ~/vscode-projects/pycobertura, configfile: tox.ini
plugins: cov-3.0.0
collected 139 items                                                                                                                                                                                            

tests/test_cli.py::test_exit_codes PASSED                                                                                                                                                                [  0%]
tests/test_cli.py::test_show__format_default PASSED                                                                                                                                                      [  1%]
tests/test_cli.py::test_show__format_text PASSED                                                                                                                                                         [  2%]
tests/test_cli.py::test_show__format_csv PASSED                                                                                                                                                          [  2%]
tests/test_cli.py::test_show__format_csv_delimiter_semicolon PASSED                                                                                                                                      [  3%]
tests/test_cli.py::test_show__format_csv_delimiter_tab PASSED                                                                                                                                            [  4%]
tests/test_cli.py::test_show__format_markdown PASSED                                                                                                                                                     [  5%]
tests/test_cli.py::test_show__format_html PASSED                                                                                                                                                         [  5%]
tests/test_cli.py::test_show__format_json PASSED                                                                                                                                                         [  6%]
tests/test_cli.py::test_show__format_yaml PASSED                                                                                                                                                         [  7%]
tests/test_cli.py::test_show__output_to_file PASSED                                                                                                                                                      [  7%]
tests/test_cli.py::test_diff__format_default PASSED                                                                                                                                                      [  8%]
tests/test_cli.py::test_diff__format_text PASSED                                                                                                                                                         [  9%]
tests/test_cli.py::test_diff__format_csv PASSED                                                                                                                                                          [ 10%]
tests/test_cli.py::test_diff__format_csv_delimiter_semicolon PASSED                                                                                                                                      [ 10%]
tests/test_cli.py::test_diff__format_csv_delimiter_tab PASSED                                                                                                                                            [ 11%]
tests/test_cli.py::test_diff__format_markdown PASSED                                                                                                                                                     [ 12%]
tests/test_cli.py::test_diff__format_json PASSED                                                                                                                                                         [ 12%]
tests/test_cli.py::test_diff__format_yaml PASSED                                                                                                                                                         [ 13%]
tests/test_cli.py::test_diff__output_to_file PASSED                                                                                                                                                      [ 14%]
tests/test_cli.py::test_diff__output_to_file__force_color PASSED                                                                                                                                         [ 15%]
tests/test_cli.py::test_diff__format_text__with_color PASSED                                                                                                                                             [ 15%]
tests/test_cli.py::test_diff__format_text__with_no_color PASSED                                                                                                                                          [ 16%]
tests/test_cli.py::test_diff__format_markdown__with_color PASSED                                                                                                                                         [ 17%]
tests/test_cli.py::test_diff__format_markdown__with_no_color PASSED                                                                                                                                      [ 17%]
tests/test_cli.py::test_diff__format_json__with_color PASSED                                                                                                                                             [ 18%]
tests/test_cli.py::test_diff__format_json__with_no_color PASSED                                                                                                                                          [ 19%]
tests/test_cli.py::test_diff__format_yaml_with_color PASSED                                                                                                                                              [ 20%]
tests/test_cli.py::test_diff__format_yaml_with_no_color PASSED                                                                                                                                           [ 20%]
tests/test_cli.py::test_diff__format_html__no_source_on_disk PASSED                                                                                                                                      [ 21%]
tests/test_cli.py::test_diff__format_html__with_source_prefix[tests/-tests/dummy-dummy/-] PASSED                                                                                                         [ 22%]
tests/test_cli.py::test_diff__format_html__with_source_prefix[tests/dummy-tests/--dummy/] PASSED                                                                                                         [ 23%]
tests/test_cli.py::test_diff__format_html__with_source_prefix[tests/dummy/dummy.zip-tests/dummy/dummy.zip--] PASSED                                                                                      [ 23%]
tests/test_cli.py::test_diff__format_html__with_source_prefix[tests/dummy/dummy-with-prefix.zip-tests/dummy-dummy-with-prefix-] PASSED                                                                   [ 24%]
tests/test_cli.py::test_diff__format_html__with_source_prefix[tests/dummy/dummy-with-prefix.zip-tests/dummy/dummy.zip-dummy-with-prefix-] PASSED                                                         [ 25%]
tests/test_cli.py::test_diff__format_html__with_source[tests/dummy-tests/dummy] PASSED                                                                                                                   [ 25%]
tests/test_cli.py::test_diff__format_html__with_source[tests/dummy/dummy.zip-tests/dummy/dummy.zip] PASSED                                                                                               [ 26%]
tests/test_cli.py::test_diff__format_html__source PASSED                                                                                                                                                 [ 27%]
tests/test_cli.py::test_diff__format_html__source_is_default PASSED                                                                                                                                      [ 28%]
tests/test_cli.py::test_diff__format_html__no_source PASSED                                                                                                                                              [ 28%]
tests/test_cli.py::test_diff__same_coverage_has_exit_status_of_zero PASSED                                                                                                                               [ 29%]
tests/test_cli.py::test_diff__better_coverage_has_exit_status_of_zero PASSED                                                                                                                             [ 30%]
tests/test_cli.py::test_diff__worse_coverage_exit_status PASSED                                                                                                                                          [ 30%]
tests/test_cli.py::test_diff__changes_uncovered_but_with_better_coverage_exit_status PASSED                                                                                                              [ 31%]
tests/test_cli.py::test_diff__line_status PASSED                                                                                                                                                         [ 32%]
tests/test_cobertura.py::test_parse_path PASSED                                                                                                                                                          [ 33%]
tests/test_cobertura.py::test_parse_file_object PASSED                                                                                                                                                   [ 33%]
tests/test_cobertura.py::test_parse_string PASSED                                                                                                                                                        [ 34%]
tests/test_cobertura.py::test_invalid_coverage_report PASSED                                                                                                                                             [ 35%]
tests/test_cobertura.py::test_version PASSED                                                                                                                                                             [ 35%]
tests/test_cobertura.py::test_line_rate PASSED                                                                                                                                                           [ 36%]
tests/test_cobertura.py::test_line_rate_by_class_file PASSED                                                                                                                                             [ 37%]
tests/test_cobertura.py::test_branch_rate PASSED                                                                                                                                                         [ 38%]
tests/test_cobertura.py::test_branch_rate_by_class_file PASSED                                                                                                                                           [ 38%]
tests/test_cobertura.py::test_missed_statements_by_class_file PASSED                                                                                                                                     [ 39%]
tests/test_cobertura.py::test_list_packages PASSED                                                                                                                                                       [ 40%]
tests/test_cobertura.py::test_list_classes[tests/cobertura-generated-by-istanbul-from-coffeescript.xml-expected0] PASSED                                                                                 [ 41%]
tests/test_cobertura.py::test_list_classes[tests/cobertura.xml-expected1] PASSED                                                                                                                         [ 41%]
tests/test_cobertura.py::test_hit_lines__by_iterating_over_classes PASSED                                                                                                                                [ 42%]
tests/test_cobertura.py::test_missed_lines PASSED                                                                                                                                                        [ 43%]
tests/test_cobertura.py::test_total_statements PASSED                                                                                                                                                    [ 43%]
tests/test_cobertura.py::test_total_statements_by_class_file PASSED                                                                                                                                      [ 44%]
tests/test_cobertura.py::test_total_misses PASSED                                                                                                                                                        [ 45%]
tests/test_cobertura.py::test_total_misses_by_class_file PASSED                                                                                                                                          [ 46%]
tests/test_cobertura.py::test_total_hits PASSED                                                                                                                                                          [ 46%]
tests/test_cobertura.py::test_total_hits_by_class_file PASSED                                                                                                                                            [ 47%]
tests/test_cobertura.py::test_class_file_source__sources_not_found PASSED                                                                                                                                [ 48%]
tests/test_cobertura.py::test_line_statuses PASSED                                                                                                                                                       [ 48%]
tests/test_cobertura.py::test_class_file_source__sources_found[tests/dummy.source1/coverage.xml-None-None] PASSED                                                                                        [ 49%]
tests/test_cobertura.py::test_class_file_source__sources_found[tests/dummy.source1/coverage.xml-tests/-dummy.source1/] PASSED                                                                            [ 50%]
tests/test_cobertura.py::test_class_file_source__raises_when_no_filesystem PASSED                                                                                                                        [ 51%]
tests/test_cobertura.py::test_class_source_lines__raises_when_no_filesystem PASSED                                                                                                                       [ 51%]
tests/test_cobertura_diff.py::test_diff_class_source PASSED                                                                                                                                              [ 52%]
tests/test_cobertura_diff.py::test_diff_total_misses PASSED                                                                                                                                              [ 53%]
tests/test_cobertura_diff.py::test_diff_total_misses_by_class_file PASSED                                                                                                                                [ 53%]
tests/test_cobertura_diff.py::test_diff_line_rate PASSED                                                                                                                                                 [ 54%]
tests/test_cobertura_diff.py::test_diff_line_rate_by_class_file PASSED                                                                                                                                   [ 55%]
tests/test_cobertura_diff.py::test_diff_same_report_different_source_dirs PASSED                                                                                                                         [ 56%]
tests/test_cobertura_diff.py::test_diff_total_hits PASSED                                                                                                                                                [ 56%]
tests/test_cobertura_diff.py::test_diff_total_hits_by_class_file PASSED                                                                                                                                  [ 57%]
tests/test_cobertura_diff.py::test_diff__has_all_changes_covered__some_changed_code_is_still_uncovered PASSED                                                                                            [ 58%]
tests/test_cobertura_diff.py::test_diff__has_better_coverage PASSED                                                                                                                                      [ 58%]
tests/test_cobertura_diff.py::test_diff__has_not_better_coverage PASSED                                                                                                                                  [ 59%]
tests/test_colorize.py::test_colorize PASSED                                                                                                                                                             [ 60%]
tests/test_extrapolate_coverage.py::test_extrapolate_coverage PASSED                                                                                                                                     [ 61%]
tests/test_filesystem.py::test_filesystem_directory__file_not_found PASSED                                                                                                                               [ 61%]
tests/test_filesystem.py::test_filesystem_directory__returns_fileobject PASSED                                                                                                                           [ 62%]
tests/test_filesystem.py::test_filesystem_directory__with_source_prefix PASSED                                                                                                                           [ 63%]
tests/test_filesystem.py::test_filesystem_zip__file_not_found PASSED                                                                                                                                     [ 64%]
tests/test_filesystem.py::test_filesystem_zip__returns_fileobject PASSED                                                                                                                                 [ 64%]
tests/test_filesystem.py::test_filesystem_zip__with_source_prefix PASSED                                                                                                                                 [ 65%]
tests/test_filesystem.py::test_filesystem_git PASSED                                                                                                                                                     [ 66%]
tests/test_filesystem.py::test_filesystem_git_integration PASSED                                                                                                                                         [ 66%]
tests/test_filesystem.py::test_filesystem_git_integration__not_found PASSED                                                                                                                              [ 67%]
tests/test_filesystem.py::test_filesystem_git__git_not_found PASSED                                                                                                                                      [ 68%]
tests/test_filesystem.py::test_filesystem_git_has_file_integration PASSED                                                                                                                                [ 69%]
tests/test_filesystem.py::test_filesystem_git_has_file_integration__not_found PASSED                                                                                                                     [ 69%]
tests/test_filesystem.py::test_filesystem_factory PASSED                                                                                                                                                 [ 70%]
tests/test_hunkify_coverage.py::test_hunkify_coverage__top PASSED                                                                                                                                        [ 71%]
tests/test_hunkify_coverage.py::test_hunkify_coverage__bottom PASSED                                                                                                                                     [ 71%]
tests/test_hunkify_coverage.py::test_hunkify_coverage__middle PASSED                                                                                                                                     [ 72%]
tests/test_hunkify_coverage.py::test_hunkify_coverage__overlapping PASSED                                                                                                                                [ 73%]
tests/test_hunkify_coverage.py::test_hunkify_coverage__2_contiguous_hunks_w_full_context_makes_1_hunk PASSED                                                                                             [ 74%]
tests/test_hunkify_coverage.py::test_hunkify_coverage__2_distant_hunks_w_full_context_makes_2_hunk PASSED                                                                                                [ 74%]
tests/test_hunkify_coverage.py::test_hunkify_coverage__no_valid_hunks_found PASSED                                                                                                                       [ 75%]
tests/test_imports.py::test_imports PASSED                                                                                                                                                               [ 76%]
tests/test_rangify.py::test_rangify_func__1 PASSED                                                                                                                                                       [ 76%]
tests/test_rangify.py::test_rangify_func__1_2 PASSED                                                                                                                                                     [ 77%]
tests/test_rangify.py::test_rangify_func__1_2_3 PASSED                                                                                                                                                   [ 78%]
tests/test_rangify.py::test_rangify_func__1_2_3_and_7 PASSED                                                                                                                                             [ 79%]
tests/test_rangify.py::test_rangify_func__1_2_3_and_7_8 PASSED                                                                                                                                           [ 79%]
tests/test_rangify.py::test_rangify_func__1_2_3_and_7_8_9 PASSED                                                                                                                                         [ 80%]
tests/test_rangify.py::test_rangify_func__1_and_7_8_9 PASSED                                                                                                                                             [ 81%]
tests/test_rangify.py::test_rangify_func__1_2_and_7_8_9 PASSED                                                                                                                                           [ 82%]
tests/test_rangify.py::test_rangify_func__1_and_7 PASSED                                                                                                                                                 [ 82%]
tests/test_reconcile_lines.py::test_reconcile_lines__identical PASSED                                                                                                                                    [ 83%]
tests/test_reconcile_lines.py::test_reconcile_lines__less_to_more PASSED                                                                                                                                 [ 84%]
tests/test_reconcile_lines.py::test_reconcile_lines__more_to_less PASSED                                                                                                                                 [ 84%]
tests/test_reporters.py::test_text_report PASSED                                                                                                                                                         [ 85%]
tests/test_reporters.py::test_text_report__with_missing_range PASSED                                                                                                                                     [ 86%]
tests/test_reporters.py::test_text_report_delta__no_diff PASSED                                                                                                                                          [ 87%]
tests/test_reporters.py::test_text_report_delta__colorize_True PASSED                                                                                                                                    [ 87%]
tests/test_reporters.py::test_text_report_delta__colorize_True__with_missing_range PASSED                                                                                                                [ 88%]
tests/test_reporters.py::test_text_report_delta__colorize_False PASSED                                                                                                                                   [ 89%]
tests/test_reporters.py::test_html_report PASSED                                                                                                                                                         [ 89%]
tests/test_reporters.py::test_html_report__no_source_files_message PASSED                                                                                                                                [ 90%]
tests/test_reporters.py::test_text_report_delta__no_source PASSED                                                                                                                                        [ 91%]
tests/test_reporters.py::test_html_report_delta__no_source PASSED                                                                                                                                        [ 92%]
tests/test_reporters.py::test_html_report_delta PASSED                                                                                                                                                   [ 92%]
tests/test_reporters.py::test_html_report_delta__show_missing_False PASSED                                                                                                                               [ 93%]
tests/test_stringify.py::test_stringify_func__empty_bracket PASSED                                                                                                                                       [ 94%]
tests/test_stringify.py::test_stringify_func__1_2 PASSED                                                                                                                                                 [ 94%]
tests/test_stringify.py::test_stringify_func__1_2_3 PASSED                                                                                                                                               [ 95%]
tests/test_stringify.py::test_stringify_func__1_2_3_and_7 PASSED                                                                                                                                         [ 96%]
tests/test_stringify.py::test_stringify_func__1_2_3_and_7_8 PASSED                                                                                                                                       [ 97%]
tests/test_stringify.py::test_stringify_func__1_2_3_and_7_8_9 PASSED                                                                                                                                     [ 97%]
tests/test_stringify.py::test_stringify_func__1_and_7_8_9 PASSED                                                                                                                                         [ 98%]
tests/test_stringify.py::test_stringify_func__1_2_and_7_8_9 PASSED                                                                                                                                       [ 99%]
tests/test_stringify.py::test_stringify_func__1_and_7 PASSED                                                                                                                                             [100%]

---------------------------------------------------------------- generated xml file: /Users/michaelgross/vscode-projects/pycobertura/junit.xml -----------------------------------------------------------------
============================================================================================= 139 passed in 0.55s ==============================================================================================
(py39) $ 

@gro1m
Copy link
Contributor Author

gro1m commented Mar 22, 2022

But the prefix is missing in the pycobertura show command, there we would need an --include option instead of --source...

@aconrad
Copy link
Owner

aconrad commented Mar 23, 2022

I don't understand what changed with this PR. I thought the coverage.xml file would contain filenames such as filename="pycobertura/cli.py" instead of filename="cli.py". Is that not what changed?

@gro1m
Copy link
Contributor Author

gro1m commented Mar 26, 2022

Hi @aconrad
I try to explain it again. I moved to pytest.ini, but in principal it does not matter.
The output of pytest is correct, but the subsequent show command not, because pytest uses the coverage library, but pycobertura does not (compare setup.cfg install_requires block to test_requirements.txt, which actually should go in a test_requires block in setup.cfg):

(py39) $ pytest
====================================================================== test session starts =======================================================================
platform darwin -- Python 3.9.7, pytest-7.1.1, pluggy-1.0.0 -- ~/opt/anaconda3/envs/py39/bin/python
cachedir: .pytest_cache
rootdir: ~/vscode-projects/pycobertura, configfile: pytest.ini
plugins: cov-3.0.0
collected 139 items                                                                                                                                              

tests/test_cli.py::test_exit_codes PASSED                                                                                                                  [  0%]
tests/test_cli.py::test_show__format_default PASSED                                                                                                        [  1%]
tests/test_cli.py::test_show__format_text PASSED                                                                                                           [  2%]
tests/test_cli.py::test_show__format_csv PASSED                                                                                                            [  2%]
tests/test_cli.py::test_show__format_csv_delimiter_semicolon PASSED                                                                                        [  3%]
tests/test_cli.py::test_show__format_csv_delimiter_tab PASSED                                                                                              [  4%]
tests/test_cli.py::test_show__format_markdown PASSED                                                                                                       [  5%]
tests/test_cli.py::test_show__format_html PASSED                                                                                                           [  5%]
tests/test_cli.py::test_show__format_json PASSED                                                                                                           [  6%]
tests/test_cli.py::test_show__format_yaml PASSED                                                                                                           [  7%]
tests/test_cli.py::test_show__output_to_file PASSED                                                                                                        [  7%]
tests/test_cli.py::test_diff__format_default PASSED                                                                                                        [  8%]
tests/test_cli.py::test_diff__format_text PASSED                                                                                                           [  9%]
tests/test_cli.py::test_diff__format_csv PASSED                                                                                                            [ 10%]
tests/test_cli.py::test_diff__format_csv_delimiter_semicolon PASSED                                                                                        [ 10%]
tests/test_cli.py::test_diff__format_csv_delimiter_tab PASSED                                                                                              [ 11%]
tests/test_cli.py::test_diff__format_markdown PASSED                                                                                                       [ 12%]
tests/test_cli.py::test_diff__format_json PASSED                                                                                                           [ 12%]
tests/test_cli.py::test_diff__format_yaml PASSED                                                                                                           [ 13%]
tests/test_cli.py::test_diff__output_to_file PASSED                                                                                                        [ 14%]
tests/test_cli.py::test_diff__output_to_file__force_color PASSED                                                                                           [ 15%]
tests/test_cli.py::test_diff__format_text__with_color PASSED                                                                                               [ 15%]
tests/test_cli.py::test_diff__format_text__with_no_color PASSED                                                                                            [ 16%]
tests/test_cli.py::test_diff__format_markdown__with_color PASSED                                                                                           [ 17%]
tests/test_cli.py::test_diff__format_markdown__with_no_color PASSED                                                                                        [ 17%]
tests/test_cli.py::test_diff__format_json__with_color PASSED                                                                                               [ 18%]
tests/test_cli.py::test_diff__format_json__with_no_color PASSED                                                                                            [ 19%]
tests/test_cli.py::test_diff__format_yaml_with_color PASSED                                                                                                [ 20%]
tests/test_cli.py::test_diff__format_yaml_with_no_color PASSED                                                                                             [ 20%]
tests/test_cli.py::test_diff__format_html__no_source_on_disk PASSED                                                                                        [ 21%]
tests/test_cli.py::test_diff__format_html__with_source_prefix[tests/-tests/dummy-dummy/-] PASSED                                                           [ 22%]
tests/test_cli.py::test_diff__format_html__with_source_prefix[tests/dummy-tests/--dummy/] PASSED                                                           [ 23%]
tests/test_cli.py::test_diff__format_html__with_source_prefix[tests/dummy/dummy.zip-tests/dummy/dummy.zip--] PASSED                                        [ 23%]
tests/test_cli.py::test_diff__format_html__with_source_prefix[tests/dummy/dummy-with-prefix.zip-tests/dummy-dummy-with-prefix-] PASSED                     [ 24%]
tests/test_cli.py::test_diff__format_html__with_source_prefix[tests/dummy/dummy-with-prefix.zip-tests/dummy/dummy.zip-dummy-with-prefix-] PASSED           [ 25%]
tests/test_cli.py::test_diff__format_html__with_source[tests/dummy-tests/dummy] PASSED                                                                     [ 25%]
tests/test_cli.py::test_diff__format_html__with_source[tests/dummy/dummy.zip-tests/dummy/dummy.zip] PASSED                                                 [ 26%]
tests/test_cli.py::test_diff__format_html__source PASSED                                                                                                   [ 27%]
tests/test_cli.py::test_diff__format_html__source_is_default PASSED                                                                                        [ 28%]
tests/test_cli.py::test_diff__format_html__no_source PASSED                                                                                                [ 28%]
tests/test_cli.py::test_diff__same_coverage_has_exit_status_of_zero PASSED                                                                                 [ 29%]
tests/test_cli.py::test_diff__better_coverage_has_exit_status_of_zero PASSED                                                                               [ 30%]
tests/test_cli.py::test_diff__worse_coverage_exit_status PASSED                                                                                            [ 30%]
tests/test_cli.py::test_diff__changes_uncovered_but_with_better_coverage_exit_status PASSED                                                                [ 31%]
tests/test_cli.py::test_diff__line_status PASSED                                                                                                           [ 32%]
tests/test_cobertura.py::test_parse_path PASSED                                                                                                            [ 33%]
tests/test_cobertura.py::test_parse_file_object PASSED                                                                                                     [ 33%]
tests/test_cobertura.py::test_parse_string PASSED                                                                                                          [ 34%]
tests/test_cobertura.py::test_invalid_coverage_report PASSED                                                                                               [ 35%]
tests/test_cobertura.py::test_version PASSED                                                                                                               [ 35%]
tests/test_cobertura.py::test_line_rate PASSED                                                                                                             [ 36%]
tests/test_cobertura.py::test_line_rate_by_class_file PASSED                                                                                               [ 37%]
tests/test_cobertura.py::test_branch_rate PASSED                                                                                                           [ 38%]
tests/test_cobertura.py::test_branch_rate_by_class_file PASSED                                                                                             [ 38%]
tests/test_cobertura.py::test_missed_statements_by_class_file PASSED                                                                                       [ 39%]
tests/test_cobertura.py::test_list_packages PASSED                                                                                                         [ 40%]
tests/test_cobertura.py::test_list_classes[tests/cobertura-generated-by-istanbul-from-coffeescript.xml-expected0] PASSED                                   [ 41%]
tests/test_cobertura.py::test_list_classes[tests/cobertura.xml-expected1] PASSED                                                                           [ 41%]
tests/test_cobertura.py::test_hit_lines__by_iterating_over_classes PASSED                                                                                  [ 42%]
tests/test_cobertura.py::test_missed_lines PASSED                                                                                                          [ 43%]
tests/test_cobertura.py::test_total_statements PASSED                                                                                                      [ 43%]
tests/test_cobertura.py::test_total_statements_by_class_file PASSED                                                                                        [ 44%]
tests/test_cobertura.py::test_total_misses PASSED                                                                                                          [ 45%]
tests/test_cobertura.py::test_total_misses_by_class_file PASSED                                                                                            [ 46%]
tests/test_cobertura.py::test_total_hits PASSED                                                                                                            [ 46%]
tests/test_cobertura.py::test_total_hits_by_class_file PASSED                                                                                              [ 47%]
tests/test_cobertura.py::test_class_file_source__sources_not_found PASSED                                                                                  [ 48%]
tests/test_cobertura.py::test_line_statuses PASSED                                                                                                         [ 48%]
tests/test_cobertura.py::test_class_file_source__sources_found[tests/dummy.source1/coverage.xml-None-None] PASSED                                          [ 49%]
tests/test_cobertura.py::test_class_file_source__sources_found[tests/dummy.source1/coverage.xml-tests/-dummy.source1/] PASSED                              [ 50%]
tests/test_cobertura.py::test_class_file_source__raises_when_no_filesystem PASSED                                                                          [ 51%]
tests/test_cobertura.py::test_class_source_lines__raises_when_no_filesystem PASSED                                                                         [ 51%]
tests/test_cobertura_diff.py::test_diff_class_source PASSED                                                                                                [ 52%]
tests/test_cobertura_diff.py::test_diff_total_misses PASSED                                                                                                [ 53%]
tests/test_cobertura_diff.py::test_diff_total_misses_by_class_file PASSED                                                                                  [ 53%]
tests/test_cobertura_diff.py::test_diff_line_rate PASSED                                                                                                   [ 54%]
tests/test_cobertura_diff.py::test_diff_line_rate_by_class_file PASSED                                                                                     [ 55%]
tests/test_cobertura_diff.py::test_diff_same_report_different_source_dirs PASSED                                                                           [ 56%]
tests/test_cobertura_diff.py::test_diff_total_hits PASSED                                                                                                  [ 56%]
tests/test_cobertura_diff.py::test_diff_total_hits_by_class_file PASSED                                                                                    [ 57%]
tests/test_cobertura_diff.py::test_diff__has_all_changes_covered__some_changed_code_is_still_uncovered PASSED                                              [ 58%]
tests/test_cobertura_diff.py::test_diff__has_better_coverage PASSED                                                                                        [ 58%]
tests/test_cobertura_diff.py::test_diff__has_not_better_coverage PASSED                                                                                    [ 59%]
tests/test_colorize.py::test_colorize PASSED                                                                                                               [ 60%]
tests/test_extrapolate_coverage.py::test_extrapolate_coverage PASSED                                                                                       [ 61%]
tests/test_filesystem.py::test_filesystem_directory__file_not_found PASSED                                                                                 [ 61%]
tests/test_filesystem.py::test_filesystem_directory__returns_fileobject PASSED                                                                             [ 62%]
tests/test_filesystem.py::test_filesystem_directory__with_source_prefix PASSED                                                                             [ 63%]
tests/test_filesystem.py::test_filesystem_zip__file_not_found PASSED                                                                                       [ 64%]
tests/test_filesystem.py::test_filesystem_zip__returns_fileobject PASSED                                                                                   [ 64%]
tests/test_filesystem.py::test_filesystem_zip__with_source_prefix PASSED                                                                                   [ 65%]
tests/test_filesystem.py::test_filesystem_git PASSED                                                                                                       [ 66%]
tests/test_filesystem.py::test_filesystem_git_integration PASSED                                                                                           [ 66%]
tests/test_filesystem.py::test_filesystem_git_integration__not_found PASSED                                                                                [ 67%]
tests/test_filesystem.py::test_filesystem_git__git_not_found PASSED                                                                                        [ 68%]
tests/test_filesystem.py::test_filesystem_git_has_file_integration PASSED                                                                                  [ 69%]
tests/test_filesystem.py::test_filesystem_git_has_file_integration__not_found PASSED                                                                       [ 69%]
tests/test_filesystem.py::test_filesystem_factory PASSED                                                                                                   [ 70%]
tests/test_hunkify_coverage.py::test_hunkify_coverage__top PASSED                                                                                          [ 71%]
tests/test_hunkify_coverage.py::test_hunkify_coverage__bottom PASSED                                                                                       [ 71%]
tests/test_hunkify_coverage.py::test_hunkify_coverage__middle PASSED                                                                                       [ 72%]
tests/test_hunkify_coverage.py::test_hunkify_coverage__overlapping PASSED                                                                                  [ 73%]
tests/test_hunkify_coverage.py::test_hunkify_coverage__2_contiguous_hunks_w_full_context_makes_1_hunk PASSED                                               [ 74%]
tests/test_hunkify_coverage.py::test_hunkify_coverage__2_distant_hunks_w_full_context_makes_2_hunk PASSED                                                  [ 74%]
tests/test_hunkify_coverage.py::test_hunkify_coverage__no_valid_hunks_found PASSED                                                                         [ 75%]
tests/test_imports.py::test_imports PASSED                                                                                                                 [ 76%]
tests/test_rangify.py::test_rangify_func__1 PASSED                                                                                                         [ 76%]
tests/test_rangify.py::test_rangify_func__1_2 PASSED                                                                                                       [ 77%]
tests/test_rangify.py::test_rangify_func__1_2_3 PASSED                                                                                                     [ 78%]
tests/test_rangify.py::test_rangify_func__1_2_3_and_7 PASSED                                                                                               [ 79%]
tests/test_rangify.py::test_rangify_func__1_2_3_and_7_8 PASSED                                                                                             [ 79%]
tests/test_rangify.py::test_rangify_func__1_2_3_and_7_8_9 PASSED                                                                                           [ 80%]
tests/test_rangify.py::test_rangify_func__1_and_7_8_9 PASSED                                                                                               [ 81%]
tests/test_rangify.py::test_rangify_func__1_2_and_7_8_9 PASSED                                                                                             [ 82%]
tests/test_rangify.py::test_rangify_func__1_and_7 PASSED                                                                                                   [ 82%]
tests/test_reconcile_lines.py::test_reconcile_lines__identical PASSED                                                                                      [ 83%]
tests/test_reconcile_lines.py::test_reconcile_lines__less_to_more PASSED                                                                                   [ 84%]
tests/test_reconcile_lines.py::test_reconcile_lines__more_to_less PASSED                                                                                   [ 84%]
tests/test_reporters.py::test_text_report PASSED                                                                                                           [ 85%]
tests/test_reporters.py::test_text_report__with_missing_range PASSED                                                                                       [ 86%]
tests/test_reporters.py::test_text_report_delta__no_diff PASSED                                                                                            [ 87%]
tests/test_reporters.py::test_text_report_delta__colorize_True PASSED                                                                                      [ 87%]
tests/test_reporters.py::test_text_report_delta__colorize_True__with_missing_range PASSED                                                                  [ 88%]
tests/test_reporters.py::test_text_report_delta__colorize_False PASSED                                                                                     [ 89%]
tests/test_reporters.py::test_html_report PASSED                                                                                                           [ 89%]
tests/test_reporters.py::test_html_report__no_source_files_message PASSED                                                                                  [ 90%]
tests/test_reporters.py::test_text_report_delta__no_source PASSED                                                                                          [ 91%]
tests/test_reporters.py::test_html_report_delta__no_source PASSED                                                                                          [ 92%]
tests/test_reporters.py::test_html_report_delta PASSED                                                                                                     [ 92%]
tests/test_reporters.py::test_html_report_delta__show_missing_False PASSED                                                                                 [ 93%]
tests/test_stringify.py::test_stringify_func__empty_bracket PASSED                                                                                         [ 94%]
tests/test_stringify.py::test_stringify_func__1_2 PASSED                                                                                                   [ 94%]
tests/test_stringify.py::test_stringify_func__1_2_3 PASSED                                                                                                 [ 95%]
tests/test_stringify.py::test_stringify_func__1_2_3_and_7 PASSED                                                                                           [ 96%]
tests/test_stringify.py::test_stringify_func__1_2_3_and_7_8 PASSED                                                                                         [ 97%]
tests/test_stringify.py::test_stringify_func__1_2_3_and_7_8_9 PASSED                                                                                       [ 97%]
tests/test_stringify.py::test_stringify_func__1_and_7_8_9 PASSED                                                                                           [ 98%]
tests/test_stringify.py::test_stringify_func__1_2_and_7_8_9 PASSED                                                                                         [ 99%]
tests/test_stringify.py::test_stringify_func__1_and_7 PASSED                                                                                               [100%]

======================================================================== warnings summary ========================================================================
../../opt/anaconda3/envs/py39/lib/python3.9/site-packages/coverage/inorout.py:472
  ~/opt/anaconda3/envs/py39/lib/python3.9/site-packages/coverage/inorout.py:472: CoverageWarning: --include is ignored because --source is set (include-ignored)
    self.warn("--include is ignored because --source is set", slug="include-ignored")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
----------------------------------------- generated xml file:~/vscode-projects/pycobertura/junit.xml ------------------------------------------

---------- coverage: platform darwin, python 3.9.7-final-0 -----------
Name                                Stmts   Miss  Cover   Missing
-----------------------------------------------------------------
pycobertura/__init__.py                 2      0   100%
pycobertura/cli.py                     78      0   100%
pycobertura/cobertura.py              206      0   100%
pycobertura/filesystem.py              87      0   100%
pycobertura/reporters.py              192      0   100%
pycobertura/templates/__init__.py       0      0   100%
pycobertura/templates/filters.py       12      0   100%
pycobertura/utils.py                  118      1    99%   38
-----------------------------------------------------------------
TOTAL                                 695      1    99%
Coverage XML written to file coverage.xml

================================================================= 139 passed, 1 warning in 0.91s =================================================================
(py39) $ pycobertura show coverage.xml
Filename                 Stmts    Miss  Cover    Missing
---------------------  -------  ------  -------  ---------
__init__.py                  2       0  100.00%
cli.py                      78       0  100.00%
cobertura.py               206       0  100.00%
filesystem.py               87       0  100.00%
reporters.py               192       0  100.00%
utils.py                   118       1  99.15%   38
templates/__init__.py        0       0  100.00%
templates/filters.py        12       0  100.00%
TOTAL                      695       1  99.86%

@gro1m
Copy link
Contributor Author

gro1m commented Mar 26, 2022

We can make the warning disappear, if we want, because I think it is not relevant (it is a wrong warning).

@gro1m
Copy link
Contributor Author

gro1m commented Mar 26, 2022

Hi @aconrad
Sorry for the irritation, but it is really confusing :)
Unfortunately your observation is true: the problem remains. Although the output on the console is correct, the generated coverage.xml is not. I fear we need to open an issue at https://github.com/nedbat/coveragepy, because nedbat/coveragepy#578 cannot be fixed with the current PR nor the proposed fix.

@aconrad
Copy link
Owner

aconrad commented Apr 7, 2022

Happy to merge this, but my understanding is that it's just moving code around, right?

@gro1m
Copy link
Contributor Author

gro1m commented Apr 17, 2022

Hi @aconrad
This will work now - I will still need to fix the formatting, but then we should be good to work.
The hint from @nedbat to drop pytest-cov was key :)

@gro1m gro1m changed the title move pytest section from setup.cfg to tox.ini make sure that coverage.xml includes file path prefix Apr 18, 2022
Copy link
Owner

@aconrad aconrad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm on my phone right now but I'll have to check out the coverage output on my laptop today. Thanks for looking into that @gro1m ! This looks really promising!

test-requirements.txt Show resolved Hide resolved
tox.ini Show resolved Hide resolved
.coveragerc Outdated Show resolved Hide resolved
.coveragerc Outdated Show resolved Hide resolved
Copy link
Owner

@aconrad aconrad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking awesome, I'd like to merge this. Thank you for your investigation and for taking the time to post a report to the coveragepy project to get our question answered! ❤️

Can you just confirm whether we need omit = or not?

tox.ini Outdated Show resolved Hide resolved
tox.ini Outdated Show resolved Hide resolved
gro1m and others added 3 commits April 18, 2022 19:02
Co-authored-by: Alexandre Conrad-Dormoy <alexandre.conrad@gmail.com>
@gro1m
Copy link
Contributor Author

gro1m commented Apr 18, 2022

@aconrad Do we need an update on the CHANGES.md as well?

pytest.ini Show resolved Hide resolved
@aconrad
Copy link
Owner

aconrad commented Apr 18, 2022

@aconrad Do we need an update on the CHANGES.md as well?

Hmm, good question. I think this PR is part of dropping py36 and supporting py37 and onward. This change is already documented and where you've been credited, this PR is just a "bug" that needed to be fixed that we hadn't addressed the first time around.

So no, I don't think we need to document it per se. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants