<s> from nose2 import session <EOL> from nose2 . tests . _common import TestCase , Conn <EOL> from nose2 . plugins import mp <EOL> import sys <EOL> class TestMPPlugin ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . session = session . Session ( ) <EOL> self . plugin = mp . MultiProcess ( session = self . session ) <EOL> def test_gentests ( self ) : <EOL> conn = Conn ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> res = [ ] <EOL> for x in mp . gentests ( conn ) : <EOL> res . append ( x ) <EOL> self . assertEqual ( res , [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> def test_recording_plugin_interface ( self ) : <EOL> rpi = mp . RecordingPluginInterface ( ) <EOL> rpi . setTestOutcome ( None ) <EOL> rpi . getTestCaseNames ( None ) <EOL> rpi . startSubprocess ( None ) <EOL> rpi . stopSubprocess ( None ) <EOL> rpi . registerInSubprocess ( None ) <EOL> rpi . loadTestsFromModule ( None ) <EOL> rpi . loadTestsFromTestCase ( None ) <EOL> self . assertEqual ( rpi . flush ( ) , [ ( '<STR_LIT>' , None ) ] ) <EOL> def test_address ( self ) : <EOL> platform = sys . platform <EOL> try : <EOL> sys . platform = "<STR_LIT>" <EOL> host = "<STR_LIT>" <EOL> port = <NUM_LIT> <EOL> self . plugin . setAddress ( host ) <EOL> self . assertEqual ( ( self . plugin . bind_host , self . plugin . bind_port ) , <EOL> ( host , <NUM_LIT:0> ) ) <EOL> self . plugin . setAddress ( "<STR_LIT>" % ( host , port ) ) <EOL> self . assertEqual ( ( self . plugin . bind_host , self . plugin . bind_port ) , <EOL> ( host , port ) ) <EOL> self . plugin . setAddress ( None ) <EOL> self . assertEqual ( ( self . plugin . bind_host , self . plugin . bind_port ) , <EOL> ( None , <NUM_LIT:0> ) ) <EOL> sys . platform = "<STR_LIT:win32>" <EOL> self . plugin . setAddress ( host ) <EOL> self . assertEqual ( ( self . plugin . bind_host , self . plugin . bind_port ) , <EOL> ( host , <NUM_LIT:0> ) ) <EOL> self . plugin . setAddress ( "<STR_LIT>" % ( host , port ) ) <EOL> self . assertEqual ( ( self . plugin . bind_host , self . plugin . bind_port ) , <EOL> ( host , port ) ) <EOL> self . plugin . setAddress ( None ) <EOL> self . assertEqual ( ( self . plugin . bind_host , self . plugin . bind_port ) , <EOL> ( "<STR_LIT>" , <NUM_LIT:0> ) ) <EOL> finally : <EOL> sys . platform = platform </s>
