11import ast
22import os
33import unittest
4+ from typing import Any
45
56from tests .integration .test_utils import RunSubprocessMixin
67from tests .integration .test_utils import podman_compose_path
@@ -56,10 +57,10 @@ def test_podman_compose_list(self) -> None:
5657 running_containers = []
5758 self .run_subprocess_assert_returncode (command_up )
5859 out , _ = self .run_subprocess_assert_returncode (command_list )
59- out = out .decode ()
60+ str_out = out .decode ()
6061
6162 # Test for table view
62- services = out .strip ().split ("\n " )
63+ services = str_out .strip ().split ("\n " )
6364 headers = [h .strip () for h in services [0 ].split ("\t " )]
6465
6566 for service in services [1 :]:
@@ -74,16 +75,17 @@ def test_podman_compose_list(self) -> None:
7475 # Test for json view
7576 command_list .extend (["--format" , "json" ])
7677 out , _ = self .run_subprocess_assert_returncode (command_list )
77- out = out .decode ()
78- services = ast .literal_eval (out )
78+ str_out = out .decode ()
79+ json_services : Any = ast .literal_eval (str_out )
7980
80- for service in services :
81+ for service in json_services :
8182 self .assertIsInstance (service , dict )
8283 self .assertNotEqual (service .get ("Name" ), None )
8384 self .assertNotEqual (service .get ("Status" ), None )
8485 self .assertNotEqual (service .get ("ConfigFiles" ), None )
8586
86- self .assertEqual (len (services ), 3 )
87+ self .assertIsInstance (json_services , list )
88+ self .assertEqual (len (json_services ), 3 )
8789
8890 # Get container ID to remove it
8991 out , _ = self .run_subprocess_assert_returncode (command_container_id )
0 commit comments