[diffoscope] 01/01: Skip the openssh_pub_key test if ssh is < 6.9
Mattia Rizzolo
mattia at debian.org
Thu Jan 5 14:25:09 CET 2017
This is an automated email from the git hooks/post-receive script.
mattia pushed a commit to branch master
in repository diffoscope.
commit 6120ff1f582702a8c1eee36f6615c263e57edeaa
Author: Mattia Rizzolo <mattia at debian.org>
Date: Thu Jan 5 14:22:37 2017 +0100
Skip the openssh_pub_key test if ssh is < 6.9
6.9 introduced FingerprintHash to specify the fuction to use to hash the
key, and changed the default to sha256, using base64 as format.
Also, the format of the actual string is a tad different (>= 6.9 using
relative paths while < 6.9 using absolute paths).
Gbp-Dch: Short
---
tests/comparators/test_openssh_pub_key.py | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/tests/comparators/test_openssh_pub_key.py b/tests/comparators/test_openssh_pub_key.py
index 6c65293..af53911 100644
--- a/tests/comparators/test_openssh_pub_key.py
+++ b/tests/comparators/test_openssh_pub_key.py
@@ -18,18 +18,30 @@
# along with diffoscope. If not, see <https://www.gnu.org/licenses/>.
import pytest
+import subprocess
from diffoscope.config import Config
from diffoscope.comparators.openssh import PublicKeyFile
from diffoscope.comparators.missing_file import MissingFile
-from utils import skip_unless_tools_exist, data, load_fixture
+from utils import (
+ skip_unless_tool_is_at_least,
+ skip_unless_tools_exist,
+ load_fixture,
+ data,
+)
# Generated by: ssh-keygen -t dsa -C "Test1"
opensshpubkey1 = load_fixture(data('test_openssh_pub_key1.pub'))
# Generated by: ssh-keygen -t rsa -b 4096 -C "Test2"
opensshpubkey2 = load_fixture(data('test_openssh_pub_key2.pub'))
+
+def openssh_version():
+ out = subprocess.check_output(('ssh', '-V'), stderr=subprocess.STDOUT)
+ return out.decode().split()[0].split('_')[1]
+
+
def test_identification(opensshpubkey1):
assert isinstance(opensshpubkey1, PublicKeyFile)
@@ -41,7 +53,7 @@ def test_no_differences(opensshpubkey1):
def differences(opensshpubkey1, opensshpubkey2):
return opensshpubkey1.compare(opensshpubkey2).details
- at skip_unless_tools_exist('ssh-keygen')
+ at skip_unless_tool_is_at_least('ssh-keygen', openssh_version, '6.9')
def test_diff(differences):
expected_diff = open(data('openssh_pub_key_expected_diff')).read()
assert differences[0].unified_diff == expected_diff
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the diffoscope
mailing list