Skip to content

Commit 90b99fd

Browse files
authored
Merge pull request ojarva#40 from ojarva/reconfigure-ci
Add more checks to CI
2 parents e581361 + bae3700 commit 90b99fd

9 files changed

Lines changed: 29 additions & 14 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ syntax: glob
44
__pycache__/
55
*.egg-info/
66
dev/
7+
build/
8+
dist/

.isort.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[settings]
2+
line_length = 120
3+

.travis.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
language: python
22
python:
3-
- "2.6"
43
- "2.7"
54
- "3.4"
65
- "3.5"
@@ -9,5 +8,11 @@ python:
98
- "3.6-dev"
109
- "3.7-dev"
1110
- "nightly"
12-
install: "pip install -r requirements.txt"
13-
script: "python setup.py test"
11+
install:
12+
- pip install -r requirements.txt
13+
- pip install pycodestyle isort pylint
14+
script:
15+
- isort --diff --check --recursive sshpubkeys tests
16+
- pycodestyle --ignore E501,E402 --exclude=.git,dev3 sshpubkeys tests
17+
- pylint sshpubkeys tests --disable line-too-long --disable missing-docstring --disable no-self-use --disable fixme --disable bad-indentation --disable bad-continuation --disable invalid-name --disable too-many-locals --disable duplicate-code --disable too-many-branches
18+
- python setup.py test

sshpubkeys/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# pylint:disable=line-too-long
1+
# pylint:disable=line-too-long,too-many-ancestors
22

33
"""Exceptions for sshpubkeys."""
44

sshpubkeys/keys.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
import struct
2222
import sys
2323
import warnings
24+
2425
import ecdsa
2526
from cryptography.hazmat.backends import default_backend
26-
from cryptography.hazmat.primitives.asymmetric.dsa import DSAPublicNumbers, DSAParameterNumbers
27+
from cryptography.hazmat.primitives.asymmetric.dsa import DSAParameterNumbers, DSAPublicNumbers
2728
from cryptography.hazmat.primitives.asymmetric.rsa import RSAPublicNumbers
2829

2930
from .exceptions import * # pylint:disable=wildcard-import,unused-wildcard-import

tests/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"""
66

77
import unittest
8-
from sshpubkeys import *
8+
from sshpubkeys import SSHKey
99
from .valid_keys import keys as list_of_valid_keys
1010
from .valid_keys_rfc4716 import keys as list_of_valid_keys_rfc4716
1111
from .invalid_keys import keys as list_of_invalid_keys
@@ -23,7 +23,7 @@ def test_none_to_constructor(self):
2323

2424
class TestKeys(unittest.TestCase):
2525

26-
def check_key(self, pubkey, bits, fingerprint_md5, fingerprint_sha256, options, comment, **kwargs):
26+
def check_key(self, pubkey, bits, fingerprint_md5, fingerprint_sha256, options, comment, **kwargs): # pylint:disable=too-many-arguments
2727
""" Checks valid key """
2828
ssh = SSHKey(pubkey, **kwargs)
2929
ssh.parse()
@@ -72,9 +72,9 @@ def ch(option, expected_error):
7272

7373
def loop_valid(keyset, prefix):
7474
""" Loop over list of valid keys and dynamically create tests """
75-
def ch(pubkey, bits, fingerprint_md5, fingerprint_sha256, options, comment, **kwargs):
75+
def ch(pubkey, bits, fingerprint_md5, fingerprint_sha256, options, comment, **kwargs): # pylint:disable=too-many-arguments
7676
return lambda self: self.check_key(pubkey, bits, fingerprint_md5, fingerprint_sha256, options, comment, **kwargs)
77-
for i, items in enumerate(keyset):
77+
for items in keyset:
7878
modes = items.pop()
7979
prefix_tmp = "%s_%s" % (prefix, items.pop())
8080
for mode in modes:
@@ -94,7 +94,7 @@ def loop_invalid(keyset, prefix):
9494
""" Loop over list of invalid keys and dynamically create tests """
9595
def ch(pubkey, expected_error, **kwargs):
9696
return lambda self: self.check_fail(pubkey, expected_error, **kwargs)
97-
for i, items in enumerate(keyset):
97+
for items in keyset:
9898
modes = items.pop()
9999
prefix_tmp = "%s_%s" % (prefix, items.pop())
100100
for mode in modes:
@@ -105,6 +105,7 @@ def ch(pubkey, expected_error, **kwargs):
105105
pubkey, expected_error = items
106106
setattr(TestKeys, "test_%s_mode_%s" % (prefix_tmp, mode), ch(pubkey, expected_error, **kwargs))
107107

108+
108109
loop_valid(list_of_valid_keys, "valid_key")
109110
loop_valid(list_of_valid_keys_rfc4716, "valid_key_rfc4716")
110111
loop_invalid(list_of_invalid_keys, "invalid_key")

tests/invalid_keys.py

Lines changed: 3 additions & 2 deletions
Large diffs are not rendered by default.

tests/invalid_options.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
from sshpubkeys.exceptions import InvalidOptionsError, UnknownOptionNameError, InvalidOptionNameError, MissingMandatoryOptionValueError
1+
from sshpubkeys.exceptions import (InvalidOptionNameError, InvalidOptionsError, MissingMandatoryOptionValueError,
2+
UnknownOptionNameError)
3+
24
options = [
35
["includes_space", "no-user-rc ", InvalidOptionsError],
46
["includes_space_multiple", "no-user-rc, port-forwarding", InvalidOptionsError],

tests/test_dsa_keys_failing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from sshpubkeys.exceptions import *
1+
from sshpubkeys.exceptions import MalformedDataError
22

33
keys = [
44
["ssh-dss AAAAB3NzaC1kc3MAAACBAPlHIP5sD+T8/Sx1DGEiCzCXqpl7ww40jBg7wTkxu44OH6pNog5PjJt5M4NBULhKva/i+bhIM3ba+H1Or+aHWWFHACV6W2FCGk/k37ApRF8sIa4hsnN0P9qn6VfhbJKee+DBxa21WjjY/MZiljmJz7IQHx5RTxX9I/hJ7cL+aNmrAAAAFQCKteqc4IkgIrjpcpStsxYAhb3MqQAAAIEA+SfIKuTr7QPcinsZQDdmZOXqcg+u9TLzHA4c47y0Kns3T3BVPr9rWdmuh6eImzLO4wMLxLvcg3ecrqFuiCp1IHvXENkGlpB17S+uOXlVDY+sTdXyvYKRKirg5IZefIAP/m08c0QGkhFDbo4ysr9D5gXgH3LB2rMPIAbvMWm/HZQAAACBAKWtAE3hXRQX5KtI4AoIWVTly/6T4JNBt4u24ZRqV7X//CZEZ0cS5YpR/frlpUDI3WKoMtS+VmT3cBFZINashIxZyfBF8+0UX3s34HwNfp0hDW3ZdgZJU56GC2eclMantYGeVrMxgTQd80pxZFgByEhoXGeZaAwUzN8ULo9jHQo=", MalformedDataError, "too_short_data"],

0 commit comments

Comments
 (0)