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 8 tasks
nicolargo opened this issue May 7, 2024 · 5 comments
Open
1 of 8 tasks

Improve unittest #2757

nicolargo opened this issue May 7, 2024 · 5 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

Copy link

This issue is stale because it has been open for 3 months with no activity.

@nicolargo
Copy link
Owner Author

For PyTest migration (have a look to giampaolo/psutil@42c7a24)

@nicolargo
Copy link
Owner Author

Some interesting read: https://www.agest.am/write-good-python-tests

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