Skip to content

Refactor license option tests to use Mock objects instead of lambdas#467

Merged
kemzeb merged 1 commit intotox-dev:mainfrom
kemzeb:test/refactor-license-tests
Apr 8, 2025
Merged

Refactor license option tests to use Mock objects instead of lambdas#467
kemzeb merged 1 commit intotox-dev:mainfrom
kemzeb:test/refactor-license-tests

Conversation

@kemzeb
Copy link
Copy Markdown
Collaborator

@kemzeb kemzeb commented Mar 26, 2025

Using Mock objects makes the intent more clearer compared to how we were using lambdas.

Using Mock objects makes the intent more clearer compared to how we
were using lambdas.
@kemzeb
Copy link
Copy Markdown
Collaborator Author

kemzeb commented Mar 26, 2025

Really need to dig into why the test coverage keeps failing in a non-deterministic manner.

Looking at the failure:

---------- coverage: platform linux, python 3.10.16-final-0 ----------
Name                                 Stmts   Miss Branch BrPart  Cover   Missing
--------------------------------------------------------------------------------
src/pipdeptree/_discovery.py            71      0     32      1    99%   80->70
src/pipdeptree/_freeze.py               51      7      6      3    82%   64-70, 77-79, 84-85
src/pipdeptree/_models/dag.py          129      1     50      2    98%   67->69, 143
src/pipdeptree/_models/package.py      138      7     34      3    93%   84, 139->141, 142, 190, 221-224
src/pipdeptree/_render/graphviz.py      52     19     18      3    63%   29-34, 41-43, 48-56, 64-66, 101-102
src/pipdeptree/_render/json.py           7      2      0      0    71%   22-23
src/pipdeptree/_render/mermaid.py       47      0     18      1    98%   62->60
src/pipdeptree/_validate.py             66      0     38      1    99%   85->88
tests/_models/test_package.py          132      1      0      0    99%   18
tests/conftest.py                       61     61     12      0     0%   1-95
tests/our_types.py                       2      2      0      0     0%   1-5
tests/test_cli.py                       94     94      2      0     0%   1-[162](https://github.com/tox-dev/pipdeptree/actions/runs/14076981932/job/39421605633?pr=467#step:8:163)
tests/test_detect_env.py                29     29      0      0     0%   1-54
tests/test_discovery.py                105    105      0      0     0%   1-186
tests/test_freeze.py                     8      8      0      0     0%   1-12
tests/test_non_host.py                  79     79      0      0     0%   1-159
tests/test_pipdeptree.py                19     19      0      0     0%   1-41
tests/test_validate.py                  30     30      0      0     0%   1-175
tests/test_warning.py                   10     10      0      0     0%   1-18
--------------------------------------------------------------------------------
TOTAL                                 [166](https://github.com/tox-dev/pipdeptree/actions/runs/14076981932/job/39421605633?pr=467#step:8:167)3    474    274     14    74%

18 files skipped due to complete coverage.
Coverage HTML written to dir /home/runner/work/pipdeptree/pipdeptree/.tox/3.10/tmp/htmlcov
Coverage XML written to file /home/runner/work/pipdeptree/pipdeptree/.tox/coverage.3.10.xml

FAIL Required test coverage of 88.0% not reached. Total coverage: 73.77%

I notice that the test coverage fails due to the top-level files in test/ being 0% covered (this should not be true). Throughout my time observing these failures this has always been the reason for these test coverage related failures.

@kemzeb kemzeb merged commit cee533a into tox-dev:main Apr 8, 2025
19 of 21 checks passed
@kemzeb kemzeb deleted the test/refactor-license-tests branch April 8, 2025 19:45
@kemzeb kemzeb mentioned this pull request Apr 28, 2025
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.

2 participants