@@ -21,10 +21,11 @@ def containers_scope(fixture_name: str, config: Config) -> Any: # pylint: disab
2121 return config .getoption ("--container-scope" , "session" )
2222
2323
24- def execute (command : str , success_codes : Iterable [int ] = (0 ,)) -> Union [bytes , Any ]:
24+ def execute (command : str , success_codes : Iterable [int ] = (0 ,), ignore_stderr : bool = False ) -> Union [bytes , Any ]:
2525 """Run a shell command."""
2626 try :
27- output = subprocess .check_output (command , stderr = subprocess .STDOUT , shell = True )
27+ stderr_pipe = subprocess .DEVNULL if ignore_stderr else subprocess .STDOUT
28+ output = subprocess .check_output (command , stderr = stderr_pipe , shell = True )
2829 status = 0
2930 except subprocess .CalledProcessError as error :
3031 output = error .output or b""
@@ -132,12 +133,12 @@ class DockerComposeExecutor:
132133 _compose_files : Any = attr .ib (converter = str_to_list )
133134 _compose_project_name : str = attr .ib ()
134135
135- def execute (self , subcommand : str ) -> Union [bytes , Any ]:
136+ def execute (self , subcommand : str , ** kwargs : Any ) -> Union [bytes , Any ]:
136137 command = self ._compose_command
137138 for compose_file in self ._compose_files :
138139 command += ' -f "{}"' .format (compose_file )
139140 command += ' -p "{}" {}' .format (self ._compose_project_name , subcommand )
140- return execute (command )
141+ return execute (command , ** kwargs )
141142
142143
143144@pytest .fixture (scope = containers_scope )
0 commit comments