<s> import py <EOL> XSpec = py . execnet . XSpec <EOL> class TestXSpec : <EOL> def test_norm_attributes ( self ) : <EOL> spec = XSpec ( "<STR_LIT>" ) <EOL> assert spec . socket == "<STR_LIT>" <EOL> assert spec . python == "<STR_LIT>" <EOL> assert spec . chdir == "<STR_LIT>" <EOL> assert spec . nice is None <EOL> assert not hasattr ( spec , '<STR_LIT>' ) <EOL> py . test . raises ( AttributeError , "<STR_LIT>" ) <EOL> spec = XSpec ( "<STR_LIT>" ) <EOL> assert spec . socket == "<STR_LIT>" <EOL> assert spec . python == "<STR_LIT>" <EOL> assert spec . chdir is None <EOL> assert spec . nice == "<STR_LIT:3>" <EOL> spec = XSpec ( "<STR_LIT>" ) <EOL> assert spec . ssh == "<STR_LIT>" <EOL> assert spec . python == "<STR_LIT>" <EOL> assert spec . chdir == "<STR_LIT>" <EOL> spec = XSpec ( "<STR_LIT>" ) <EOL> assert spec . popen == True <EOL> def test__samefilesystem ( self ) : <EOL> assert XSpec ( "<STR_LIT>" ) . _samefilesystem ( ) <EOL> assert XSpec ( "<STR_LIT>" ) . _samefilesystem ( ) <EOL> assert not XSpec ( "<STR_LIT>" ) . _samefilesystem ( ) <EOL> def test__spec_spec ( self ) : <EOL> for x in ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> assert XSpec ( x ) . _spec == x <EOL> def test_repr_and_string ( self ) : <EOL> for x in ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> assert repr ( XSpec ( x ) ) . find ( "<STR_LIT>" ) != - <NUM_LIT:1> <EOL> assert str ( XSpec ( x ) ) == x <EOL> def test_hash_equality ( self ) : <EOL> assert XSpec ( "<STR_LIT>" ) == XSpec ( "<STR_LIT>" ) <EOL> assert hash ( XSpec ( "<STR_LIT>" ) ) == hash ( XSpec ( "<STR_LIT>" ) ) <EOL> assert XSpec ( "<STR_LIT>" ) != XSpec ( "<STR_LIT>" ) <EOL> assert hash ( XSpec ( "<STR_LIT>" ) ) != hash ( XSpec ( "<STR_LIT>" ) ) <EOL> class TestMakegateway : <EOL> def test_popen ( self ) : <EOL> gw = py . execnet . makegateway ( "<STR_LIT>" ) <EOL> assert gw . spec . python == None <EOL> rinfo = gw . _rinfo ( ) <EOL> assert rinfo . executable == py . std . sys . executable <EOL> assert rinfo . cwd == py . std . os . getcwd ( ) <EOL> assert rinfo . version_info == py . std . sys . version_info <EOL> def test_popen_nice ( self ) : <EOL> gw = py . execnet . makegateway ( "<STR_LIT>" ) <EOL> remotenice = gw . remote_exec ( """<STR_LIT>""" ) . receive ( ) <EOL> if remotenice is not None : <EOL> assert remotenice == <NUM_LIT:5> <EOL> def test_popen_explicit ( self ) : <EOL> gw = py . execnet . makegateway ( "<STR_LIT>" % py . std . sys . executable ) <EOL> assert gw . spec . python == py . std . sys . executable <EOL> rinfo = gw . _rinfo ( ) <EOL> assert rinfo . executable == py . std . sys . executable <EOL> assert rinfo . cwd == py . std . os . getcwd ( ) <EOL> assert rinfo . version_info == py . std . sys . version_info <EOL> def test_popen_cpython24 ( self ) : <EOL> for trypath in ( '<STR_LIT>' , r'<STR_LIT>' ) : <EOL> cpython24 = py . path . local . sysfind ( trypath ) <EOL> if cpython24 is not None : <EOL> cpython24 = cpython24 . realpath ( ) <EOL> break <EOL> else : <EOL> py . test . skip ( "<STR_LIT>" ) <EOL> gw = py . execnet . makegateway ( "<STR_LIT>" % cpython24 ) <EOL> rinfo = gw . _rinfo ( ) <EOL> if py . std . sys . platform != "<STR_LIT>" : <EOL> assert rinfo . executable == cpython24 <EOL> assert rinfo . cwd == py . std . os . getcwd ( ) <EOL> assert rinfo . version_info [ : <NUM_LIT:2> ] == ( <NUM_LIT:2> , <NUM_LIT:4> ) <EOL> def test_popen_cpython26 ( self ) : <EOL> for trypath in ( '<STR_LIT>' , r'<STR_LIT>' ) : <EOL> cpython26 = py . path . local . sysfind ( trypath ) <EOL> if cpython26 is not None : <EOL> break <EOL> else : <EOL> py . test . skip ( "<STR_LIT>" ) <EOL> gw = py . execnet . makegateway ( "<STR_LIT>" % cpython26 ) <EOL> rinfo = gw . _rinfo ( ) <EOL> assert rinfo . executable == cpython26 <EOL> assert rinfo . cwd == py . std . os . getcwd ( ) <EOL> assert rinfo . version_info [ : <NUM_LIT:2> ] == ( <NUM_LIT:2> , <NUM_LIT:6> ) <EOL> def test_popen_chdir_absolute ( self , testdir ) : <EOL> gw = py . execnet . makegateway ( "<STR_LIT>" % testdir . tmpdir ) <EOL> rinfo = gw . _rinfo ( ) <EOL> assert rinfo . cwd == str ( testdir . tmpdir . realpath ( ) ) <EOL> def test_popen_chdir_newsub ( self , testdir ) : <EOL> testdir . chdir ( ) <EOL> gw = py . execnet . makegateway ( "<STR_LIT>" ) <EOL> rinfo = gw . _rinfo ( ) <EOL> assert rinfo . cwd == str ( testdir . tmpdir . join ( "<STR_LIT:hello>" ) . realpath ( ) ) <EOL> def test_ssh ( self , specssh ) : <EOL> sshhost = specssh . ssh <EOL> gw = py . execnet . makegateway ( "<STR_LIT>" % sshhost ) <EOL> rinfo = gw . _rinfo ( ) <EOL> gw2 = py . execnet . SshGateway ( sshhost ) <EOL> rinfo2 = gw2 . _rinfo ( ) <EOL> assert rinfo . executable == rinfo2 . executable <EOL> assert rinfo . cwd == rinfo2 . cwd <EOL> assert rinfo . version_info == rinfo2 . version_info <EOL> def test_socket ( self , specsocket ) : <EOL> gw = py . execnet . makegateway ( "<STR_LIT>" % specsocket . socket ) <EOL> rinfo = gw . _rinfo ( ) <EOL> assert rinfo . executable <EOL> assert rinfo . cwd <EOL> assert rinfo . version_info </s>
