Skip to content

Commit

Permalink
switch to pytest-asyncio in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
piger committed Dec 14, 2021
1 parent c3872ce commit 32aa96e
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
SSH_SERVER_PORT = 30123


@pytest.fixture
def event_loop():
loop = asyncio.get_event_loop()
yield loop
loop.close()


class SSHServer(asyncssh.SSHServer):
def begin_auth(self, username):
# no auth required
Expand All @@ -42,7 +35,8 @@ def server_factory():
return SSHServer()


async def _test_run_command():
@pytest.mark.asyncio
async def test_run_command():
capture, process_factory = make_process_factory()

key = asyncssh.generate_private_key("ssh-rsa")
Expand All @@ -63,7 +57,3 @@ async def _test_run_command():
assert capture["command"] == """cd "/tmp" && uname -a"""
server.close()
return True


def test_run_command(event_loop):
assert event_loop.run_until_complete(_test_run_command()) is True

0 comments on commit 32aa96e

Please sign in to comment.