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

unit tests #27

Open
byteface opened this issue Aug 21, 2021 · 3 comments
Open

unit tests #27

byteface opened this issue Aug 21, 2021 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@byteface
Copy link
Owner

I'm bad at these. so any help tightening them up is always appreciated. plus i learn seeing what people do. However be aware changing any prints to assertions you will find bugs.

@byteface byteface added the help wanted Extra attention is needed label Aug 21, 2021
@byteface
Copy link
Owner Author

I'm likely to migrate to pytest in the future. So anyone that wants to be involved in that can put hand up here. Turns out you can already run the existing unittests from pytest.

pytest tests

Next I want to investigate breaking the monolithic tests up a bit more. This efforst on this may start in 'htmlx' to not muddy the waters here.

@byteface
Copy link
Owner Author

byteface commented Dec 8, 2024

Ran 1 test in 0.000s

OK
coverage report
Name Stmts Miss Cover

domonic/init.py 570 536 6%
domonic/decorators.py 93 75 19%
domonic/dom.py 2801 1830 35%
domonic/events.py 882 492 44%
domonic/geom/init.py 158 100 37%
domonic/geom/vec2.py 168 107 36%
domonic/geom/vec3.py 88 65 26%
domonic/html.py 186 45 76%
domonic/javascript.py 2084 1329 36%
domonic/style.py 3559 1358 62%
domonic/svg.py 79 0 100%
domonic/utils.py 168 94 44%
domonic/webapi/init.py 0 0 100%
domonic/webapi/console.py 67 39 42%
domonic/webapi/credentials.py 13 4 69%
domonic/webapi/geo.py 27 3 89%
domonic/webapi/history.py 44 25 43%
domonic/webapi/netinfo.py 13 1 92%
domonic/webapi/url.py 149 57 62%
domonic/webapi/webstorage.py 51 22 57%
domonic/webapi/xpath.py 83 57 31%
domonic/window.py 233 97 58%
tests/test_window.py 10 3 70%

TOTAL 11526 6339 45%
(venv) byteface@Michaels-Air domonic %

tests are in the Makefile. Lets increase the coverage

@byteface
Copy link
Owner Author

byteface commented Dec 8, 2024

See Makefile to run all tests:

make test

NOTE - default tests ubuntu. so will fail on window when terminal test runs. comment out locally if that's the case

or to test a single function:
python -m unittest tests.test_javascript.TestCase.test_javascript_array
python -m unittest tests.test_dQuery.TestCase.test_addClass
python -m unittest tests.test_geom.TestCase.test_vec2
python3 -m unittest tests.test_cmd.TestCase.test_cmd_dir # only windows

or to test a whole module:
python -m unittest tests.test_html
python -m unittest tests.test_CDN

to see coverage:
coverage run -m unittest discover tests/
coverage report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant