mirror of
https://github.com/nicolargo/glances.git
synced 2026-09-15 23:02:52 -04:00
test: Fix flaky tests (allow empty dicts for list plugins)
This commit is contained in:
1 parent
64d0114b00
commit
4c92e1b6e6
1 file changed
+4
-3
@@ -143,14 +143,15 @@ class TestGlances(unittest.TestCase):
|
||||
'vms',
|
||||
'npu',
|
||||
):
|
||||
if isinstance(req.json(), dict) and not req.json():
|
||||
# Specific case for plugins that can be empty on VM (like sensors, containers...)
|
||||
# They return an empty dict instead of an empty list
|
||||
continue
|
||||
self.assertIsInstance(req.json(), list)
|
||||
if len(req.json()) > 0:
|
||||
self.assertIsInstance(req.json()[0], dict)
|
||||
else:
|
||||
self.assertIsInstance(req.json(), dict)
|
||||
# Specific case for sensors (can be empty on VM)
|
||||
if p == 'sensors' and req.json() == {}:
|
||||
continue
|
||||
|
||||
def test_004_items(self):
|
||||
"""Items."""
|
||||
|
||||
Reference in new issue
Block a user