Skip to content

Commit

Permalink
revert test_ssh to old version; skip unix domain test on windows; closes
Browse files Browse the repository at this point in the history
  • Loading branch information
tomerfiliba committed Nov 26, 2012
1 parent e6bf941 commit 0b08305
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/test_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
import unittest
from rpyc.utils.server import ThreadedServer
from rpyc import SlaveService
from plumbum import SshMachine
from rpyc.utils.ssh import SshContext


class Test_Ssh(unittest.TestCase):
def setUp(self):
if sys.platform == "win32":
self.server = None
os.environ["HOME"] = os.path.expanduser("~")
self.remote_machine = SshMachine("localhost")
self.sshctx = SshContext("localhost")
else:
# assume "ssh localhost" is configured to run without asking for password
self.server = ThreadedServer(SlaveService, hostname = "localhost",
Expand All @@ -23,20 +23,20 @@ def setUp(self):
t.setDaemon(True)
t.start()
time.sleep(0.5)
self.remote_machine = SshMachine("localhost")
self.sshctx = SshContext("localhost")

def tearDown(self):
if self.server:
self.server.close()

def test_simple(self):
conn = rpyc.classic.ssh_connect(self.remote_machine, 18888)
conn = rpyc.classic.ssh_connect(self.sshctx, 18888)
print( "server's pid =", conn.modules.os.getpid())
conn.modules.sys.stdout.write("hello over ssh\n")
conn.modules.sys.stdout.flush()

def test_connect(self):
conn2 = rpyc.ssh_connect(self.remote_machine, 18888, service=SlaveService)
conn2 = rpyc.ssh_connect(self.sshctx, 18888, service=SlaveService)
conn2.modules.sys.stdout.write("hello through rpyc.ssh_connect()\n")
conn2.modules.sys.stdout.flush()

Expand Down
6 changes: 6 additions & 0 deletions tests/test_threaded_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
from rpyc import SlaveService
import threading
import unittest
from nose import SkipTest
import socket


class BaseServerTest(object):

Expand Down Expand Up @@ -47,6 +50,9 @@ class Test_ThreadedServerOverUnixSocket(BaseServerTest, unittest.TestCase):
socket_path = tempfile.mktemp()

def _create_server(self):
if not hasattr(socket, "AF_UNIX"):
raise SkipTest("no support for AF_UNIX")

return ThreadedServer(SlaveService, socket_path=self.socket_path, auto_register=False)

def _create_client(self):
Expand Down

0 comments on commit 0b08305

Please sign in to comment.