Skip to content

Commit

Permalink
Merge pull request #15 from melexis/ignore_flake_w605
Browse files Browse the repository at this point in the history
Adding w605 to ignore as that escape sequence is for latex
  • Loading branch information
Letme authored Dec 19, 2018
2 parents be8e388 + 21379d8 commit 32d8c20
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
4 changes: 2 additions & 2 deletions mlx/coverity_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def get_snapshot_id(snapshots, idx=1):

if abs(required) > 0 and abs(required) <= num_snapshots:
# base zero
return snapshots[required-1].id
return snapshots[required - 1].id
return 0

def get_snapshot_detail(self, snapshot_id):
Expand Down Expand Up @@ -396,7 +396,7 @@ def get_defects(self, project, stream, checker=None, impact=None, kind=None, cla
name_value_pair = name_value_pair.strip()
valid, name, values = parse_two_part_term(name_value_pair, ':')
if valid:
logging.info("attr (%d) [%s] = any of ...", i+1, name)
logging.info("attr (%d) [%s] = any of ...", i + 1, name)

attribute_definition_id = self.client.factory.create('attributeDefinitionIdDataObj')
attribute_definition_id.name = name
Expand Down
22 changes: 21 additions & 1 deletion tests/test_coverity.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
try:
from unittest.mock import MagicMock, patch
# from unittest.mock import call
except ImportError as err:
except ImportError:
from mock import MagicMock, patch
# from mock import call
import mlx.coverity as cov
Expand Down Expand Up @@ -95,3 +95,23 @@ def test_defect_service_defects(self, suds_client_mock, suds_security_mock, suds
suds_username_mock.assert_called_once_with('user', 'password')

coverity_service.get_defects('projectname', 'somestream')

@patch('mlx.coverity_services.UsernameToken')
@patch('mlx.coverity_services.Security')
@patch('mlx.coverity_services.Client')
def test_configuration_service_login_no_username_error(self, suds_client_mock, suds_security_mock,
suds_username_mock):
''' Test login function of CoverityConfigurationService when error occurs'''
suds_client_mock.return_value = MagicMock(spec=Client)
suds_client_mock.return_value.service = MagicMock(spec=covservices.Service)
suds_client_mock.return_value.service.getVersion = MagicMock()
suds_security_mock.return_value = MagicMock(spec=Security)
suds_security_mock.return_value.tokens = []

# Login to Coverity and obtain stream information
coverity_conf_service = cov.CoverityConfigurationService('http', 'scan.coverity.com', '8080')
suds_client_mock.assert_called_once_with('http://scan.coverity.com:8080/ws/v9/configurationservice?wsdl')

suds_client_mock.side_effect = Exception((401, 'Unauthorized'))
coverity_conf_service.login('', '')

4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ skip_install = true
commands =
python setup.py check --strict --metadata --restructuredtext
check-manifest {toxinidir} -u
flake8 mlx tests setup.py
flake8 --ignore=W605,W391 mlx tests setup.py

[testenv:py36-check]
deps =
Expand All @@ -69,7 +69,7 @@ skip_install = true
commands =
python setup.py check --strict --metadata --restructuredtext
check-manifest {toxinidir} -u
flake8 mlx tests setup.py
flake8 --ignore=W605,W391 mlx tests setup.py


[testenv:py36-coveralls]
Expand Down

0 comments on commit 32d8c20

Please sign in to comment.