Skip to content

Commit

Permalink
Better assert formatting for PKey
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlia committed Feb 13, 2015
1 parent 75a719b commit ac8fde7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import threading

from paramiko.pkey import PKey
from paramiko.rsakey import RSAKey
from paramiko.sftp_client import SFTPClient
from paramiko.transport import Transport
Expand Down Expand Up @@ -108,6 +109,16 @@ def pytest_addoption(parser):
**env_default('GITHUB_TEAM_SLUGS'))


def pytest_assertrepr_compare(op, left, right):
if op == '==' and isinstance(left, PKey) and isinstance(right, PKey):
left_key = format_openssh_pubkey(left)
right_key = format_openssh_pubkey(right)
return [
'{!r} == {!r}'.format(left, right),
' {} != {}'.format(left_key, right_key)
]


used_port = 0


Expand Down

0 comments on commit ac8fde7

Please sign in to comment.