<s> import subprocess <EOL> from helpers import unittest <EOL> from luigi . contrib . ssh import RemoteContext <EOL> class TestMockedRemoteContext ( unittest . TestCase ) : <EOL> def test_subprocess_delegation ( self ) : <EOL> """<STR_LIT>""" <EOL> orig_Popen = subprocess . Popen <EOL> self . last_test = None <EOL> def Popen ( cmd , ** kwargs ) : <EOL> self . last_test = cmd <EOL> subprocess . Popen = Popen <EOL> context = RemoteContext ( <EOL> "<STR_LIT>" , <EOL> username = "<STR_LIT>" , <EOL> key_file = "<STR_LIT>" <EOL> ) <EOL> context . Popen ( [ "<STR_LIT>" ] ) <EOL> self . assertTrue ( "<STR_LIT>" in self . last_test ) <EOL> self . assertTrue ( "<STR_LIT>" in self . last_test ) <EOL> self . assertTrue ( "<STR_LIT>" in self . last_test ) <EOL> self . assertTrue ( "<STR_LIT>" in self . last_test ) <EOL> self . assertTrue ( "<STR_LIT>" in self . last_test ) <EOL> subprocess . Popen = orig_Popen <EOL> def test_check_output_fail_connect ( self ) : <EOL> """<STR_LIT>""" <EOL> context = RemoteContext ( "<STR_LIT>" , connect_timeout = <NUM_LIT:1> ) <EOL> self . assertRaises ( <EOL> subprocess . CalledProcessError , <EOL> context . check_output , [ "<STR_LIT>" ] <EOL> ) </s>
