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

Improve unittest #2757

Open
1 of 6 tasks
nicolargo opened this issue May 7, 2024 · 2 comments
Open
1 of 6 tasks

Improve unittest #2757

nicolargo opened this issue May 7, 2024 · 2 comments

Comments

@nicolargo
Copy link
Owner

nicolargo commented May 7, 2024

@nicolargo
Copy link
Owner Author

Improve tests by testing all the plugin/model.py methods done in Glances 4.0.0

@nicolargo
Copy link
Owner Author

nicolargo commented May 28, 2024

Pytest tesbed

Include existing unittest

./venv/bin/pip install pytest

ln -s unittest-core.py test_core.py

./venv/bin/pytest
.....................................                                                                          [100%]
37 passed in 20.43s

Also work with other unitest file:

ln -s unittest-restful.py test_restful.py

ln -s unittest-xmlrpc.py test_xmlrpc.py

./venv/bin/pytest
......................................................................                                         [100%]
70 passed in 31.61s

Add new Pytest tests

Example:

cat /home/nhe/dev/glances/glances/timer_test.py
from .timer import Timer
def test_timer():
    t = Timer(5)
    assert t is not None

./venv/bin/pytest
.                                                                                                              [100%]
1 passed in 0.09s

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

No branches or pull requests

1 participant