nicolargo / glances

Glances an Eye on your system. A top/htop alternative for GNU/Linux, BSD, Mac OS and Windows operating systems.
http://nicolargo.github.io/glances/
Other
26.79k stars 1.53k forks source link

Improve unittest #2757

Open nicolargo opened 6 months ago

nicolargo commented 6 months ago
nicolargo commented 6 months ago

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

nicolargo commented 5 months ago

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
github-actions[bot] commented 1 month ago

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

nicolargo commented 1 day ago

For PyTest migration (have a look to https://github.com/giampaolo/psutil/commit/42c7a241c1caf8d723dc360422db937d6036b40f)