daffidwilde / matching

A package for solving matching games
https://daffidwilde.github.io/matching/
MIT License
149 stars 42 forks source link

Temperamental coverage failure #161

Open daffidwilde opened 11 months ago

daffidwilde commented 11 months ago

Occasionally, we don't achieve full coverage, causing CI to fail. Rather than reducing our threshold, I'd rather rewrite the tests (or add an example) to force full coverage.

The details of the most recent failure are as follows:

  platform win32 -- Python 3.7.9, pytest-7.4.2, pluggy-1.2.0
  cachedir: .tox\py37\.pytest_cache
  Using --randomly-seed=1819805610
rootdir: /home/runner/work/matching/matching
  plugins: nbval-0.10.0, randomly-3.15.0, cov-4.1.0, hypothesis-6.84.3

And here's the coverage report:

  ----------- coverage: platform win32, python 3.7.9-final-0 -----------
  Name                                                                    Stmts   Miss  Cover
  -------------------------------------------------------------------------------------------
  .tox\py37\Lib\site-packages\matching\__init__.py                            9      0   100%
  .tox\py37\Lib\site-packages\matching\algorithms\__init__.py                 5      0   100%
  .tox\py37\Lib\site-packages\matching\algorithms\hospital_resident.py       47      0   100%
  .tox\py37\Lib\site-packages\matching\algorithms\stable_marriage.py         22      0   100%
  .tox\py37\Lib\site-packages\matching\algorithms\stable_roommates.py        68      0   100%
  .tox\py37\Lib\site-packages\matching\algorithms\student_allocation.py      54      1    98%
  .tox\py37\Lib\site-packages\matching\algorithms\util.py                     6      0   100%
  .tox\py37\Lib\site-packages\matching\base.py                               90      0   100%
  .tox\py37\Lib\site-packages\matching\exceptions.py                         10      0   100%
  .tox\py37\Lib\site-packages\matching\games\__init__.py                      5      0   100%
  .tox\py37\Lib\site-packages\matching\games\hospital_resident.py           115      0   100%
  .tox\py37\Lib\site-packages\matching\games\stable_marriage.py              88      0   100%
  .tox\py37\Lib\site-packages\matching\games\stable_roommates.py             56      0   100%
  .tox\py37\Lib\site-packages\matching\games\student_allocation.py          141      0   100%
  .tox\py37\Lib\site-packages\matching\matchings.py                          24      0   100%
  .tox\py37\Lib\site-packages\matching\players\__init__.py                    5      0   100%
  .tox\py37\Lib\site-packages\matching\players\hospital.py                   36      0   100%
  .tox\py37\Lib\site-packages\matching\players\player.py                     19      0   100%
  .tox\py37\Lib\site-packages\matching\players\project.py                    24      0   100%
  .tox\py37\Lib\site-packages\matching\players\supervisor.py                 24      0   100%
  -------------------------------------------------------------------------------------------
  TOTAL                                                                     848      1    99%

  FAIL Required test coverage of 100% not reached. Total coverage: 99.88%

It's always algorithms/student_allocation.py but I haven't been able to replicate the problem.

The full pip freeze is:

alabaster==0.7.13,attrs==23.1.0,Babel==2.12.1,backcall==0.2.0,beautifulsoup4==4.12.2,black==22.12.0,bleach==6.0.0,certifi==2023.7.22,charset-normalizer==3.2.0,click==8.1.7,colorama==0.4.6,coverage==7.2.7,cycler==0.11.0,debugpy==1.7.0,decorator==5.1.1,defusedxml==0.7.1,docutils==0.17.1,entrypoints==0.4,exceptiongroup==1.1.3,fastjsonschema==2.18.0,flake8==5.0.4,fonttools==4.38.0,hypothesis==6.79.4,idna==3.4,imagesize==1.4.1,importlib-metadata==4.2.0,importlib-resources==5.12.0,iniconfig==2.0.0,interrogate==1.5.0,ipykernel==6.16.2,ipython==7.34.0,isort==5.11.5,jedi==0.19.0,Jinja2==3.1.2,jsonschema==4.17.3,jupyter_client==7.4.9,jupyter_core==4.12.0,jupyterlab-pygments==0.2.2,kiwisolver==1.4.5,MarkupSafe==2.1.3,matching @ file:///D:/a/matching/matching/.tox/.tmp/package/1/matching-1.4.2.tar.gz#sha256=b097aa06662319d8dd265ebc162ccb45082e547673d61fbb6d4852cdce80df4f,matplotlib==3.5.3,matplotlib-inline==0.1.6,mccabe==0.7.0,mistune==3.0.1,mypy-extensions==1.0.0,nbclient==0.7.4,nbconvert==7.6.0,nbformat==5.8.0,nbsphinx==0.9.3,nbval==0.10.0,nest-asyncio==1.5.7,numpy==1.21.6,packaging==23.1,pandas==1.3.5,pandocfilters==1.5.0,parso==0.8.3,pathspec==0.11.2,pickleshare==0.7.5,Pillow==9.5.0,pip==23.2.1,pkgutil_resolve_name==1.3.10,platformdirs==3.10.0,pluggy==1.2.0,prompt-toolkit==3.0.39,psutil==5.9.5,py==1.11.0,pycodestyle==2.9.1,pyflakes==2.5.0,Pygments==2.16.1,pyparsing==3.1.1,pyrsistent==0.19.3,pytest==7.4.2,pytest-cov==4.1.0,pytest-randomly==3.12.0,python-dateutil==2.8.2,pytz==2023.3.post1,pywin32==306,PyYAML==6.0.1,pyzmq==25.1.1,requests==2.31.0,setuptools==68.0.0,six==1.16.0,snowballstemmer==2.2.0,sortedcontainers==2.4.0,soupsieve==2.4.1,Sphinx==4.3.2,sphinxcontrib-applehelp==1.0.2,sphinxcontrib-devhelp==1.0.2,sphinxcontrib-htmlhelp==2.0.0,sphinxcontrib-jsmath==1.0.1,sphinxcontrib-qthelp==1.0.3,sphinxcontrib-serializinghtml==1.1.5,tabulate==0.9.0,tinycss2==1.2.1,tokenize-rt==5.0.0,toml==0.10.2,tomli==2.0.1,tornado==6.2,traitlets==5.9.0,typed-ast==1.5.5,typing_extensions==4.7.1,urllib3==2.0.4,wcwidth==0.2.6,webencodings==0.5.1,wheel==0.41.2,zipp==3.15.0
daffidwilde commented 11 months ago

I was wrong! The original failed run was something else...