Skip to content

Commit

Permalink
Make the test compliant with Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolargo committed Dec 29, 2024
1 parent acb206e commit c372d35
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def _common_plugin_tests(self, plugin):
plugin_instance.update_stats_history()
plugin_instance.update_views()

# Check history
# Check stats history
# Not working on WINDOWS
if plugin_instance.history_enable() and not WINDOWS:
if isinstance(plugin_instance.get_raw(), dict):
Expand Down Expand Up @@ -160,16 +160,19 @@ def _common_plugin_tests(self, plugin):

# Check views
self.assertIsInstance(plugin_instance.get_views(), dict)
if isinstance(plugin_instance.get_raw(), dict):
self.assertIsInstance(plugin_instance.get_views(first_history_field), dict)
self.assertTrue('decoration' in plugin_instance.get_views(first_history_field))
elif isinstance(plugin_instance.get_raw(), list) and len(plugin_instance.get_raw()) > 0:
first_history_field = plugin_instance.get_items_history_list()[0]['name']
first_item = plugin_instance.get_raw()[0][plugin_instance.get_key()]
self.assertIsInstance(plugin_instance.get_views(item=first_item, key=first_history_field), dict)
self.assertTrue('decoration' in plugin_instance.get_views(item=first_item, key=first_history_field))
self.assertIsInstance(json.loads(plugin_instance.get_json_views()), dict)
self.assertEqual(json.loads(plugin_instance.get_json_views()), plugin_instance.get_views())
# Check views history
# Not working on WINDOWS
if plugin_instance.history_enable() and not WINDOWS:
if isinstance(plugin_instance.get_raw(), dict):
self.assertIsInstance(plugin_instance.get_views(first_history_field), dict)
self.assertTrue('decoration' in plugin_instance.get_views(first_history_field))
elif isinstance(plugin_instance.get_raw(), list) and len(plugin_instance.get_raw()) > 0:
first_history_field = plugin_instance.get_items_history_list()[0]['name']
first_item = plugin_instance.get_raw()[0][plugin_instance.get_key()]
self.assertIsInstance(plugin_instance.get_views(item=first_item, key=first_history_field), dict)
self.assertTrue('decoration' in plugin_instance.get_views(item=first_item, key=first_history_field))

def test_000_update(self):
"""Update stats (mandatory step for all the stats).
Expand Down

0 comments on commit c372d35

Please sign in to comment.