Skip to content

Commit 6b5eb5d

Browse files
authored
Remove blocking check. (#140)
* Remove blocking check. * Pylint fixes.
1 parent 105f0f6 commit 6b5eb5d

12 files changed

+22
-32
lines changed

.pylintrc

+1-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@
99
# R0401 cyclic-import
1010
# R0205 useless-object-inheritance
1111
# R1717 consider-using-dict-comprehension
12-
disable=W0511,C0111,C0103,I0011,R0913,R0903,R0401,R0205,R1717
13-
14-
# note: This is useful but some pylint suppressions only apply to Python 2 or 3
15-
# and we run pylint on both Python 2 and 3. e.g. You may see some no-member useless-suppression messages.
16-
enable=useless-suppression
12+
disable=W0511,C0111,C0103,I0011,R0913,R0903,R0401,R0205,R1717,useless-suppression
1713

1814
[FORMAT]
1915
max-line-length=120

knack/arguments.py

-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ def __init__(self, dest=None, argtype=None, **kwargs):
5959

6060
# We'll do an early fault detection to find any instances where we have inconsistent
6161
# set of parameters for argparse
62-
if not self.options_list and 'required' in self.options: # pylint: disable=access-member-before-definition
63-
raise ValueError('You can\'t specify both required and an options_list')
6462
if not self.options.get('dest', False):
6563
raise ValueError('Missing dest')
6664
if not self.options_list: # pylint: disable=access-member-before-definition

knack/config.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ def get(self, section, option, fallback=_UNSET):
6262
except (configparser.NoSectionError, configparser.NoOptionError):
6363
if fallback is _UNSET:
6464
raise
65-
else:
66-
return fallback
65+
return fallback
6766

6867
def getint(self, section, option, fallback=_UNSET):
6968
return int(self.get(section, option, fallback))

knack/testsdk/base.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def __init__(self, cli, command, expect_failure=False):
207207
logger.error('Command "%s" => %d. (It did not fail as expected) Output: %s', command,
208208
self.exit_code, self.output)
209209
raise AssertionError('The command did not fail as it was expected.')
210-
elif not expect_failure and self.exit_code != 0:
210+
if not expect_failure and self.exit_code != 0:
211211
logger.error('Command "%s" => %d. Output: %s', command, self.exit_code, self.output)
212212
raise AssertionError('The command failed. Exit code: {}'.format(self.exit_code))
213213

@@ -255,8 +255,7 @@ def _in_process_execute(self, command):
255255
except CliExecutionError as ex:
256256
if ex.exception:
257257
raise ex.exception
258-
else:
259-
raise ex
258+
raise ex
260259
except Exception as ex: # pylint: disable=broad-except
261260
self.exit_code = 1
262261
self.output = out_buffer.getvalue()

knack/testsdk/checkers.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ def __call__(self, execution_result):
2121
if actual_result:
2222
raise JMESPathCheckAssertionError(self._query, self._expected_result, actual_result,
2323
execution_result.output)
24-
else:
25-
raise JMESPathCheckAssertionError(self._query, self._expected_result, 'None',
26-
execution_result.output)
24+
raise JMESPathCheckAssertionError(self._query, self._expected_result, 'None',
25+
execution_result.output)
2726

2827

2928
class JMESPathCheckExists(object): # pylint: disable=too-few-public-methods
@@ -54,9 +53,8 @@ def __call__(self, execution_result):
5453
if actual_result:
5554
raise JMESPathCheckAssertionError(self._query, expected_result_format, actual_result,
5655
execution_result.output)
57-
else:
58-
raise JMESPathCheckAssertionError(self._query, expected_result_format, 'None',
59-
execution_result.output)
56+
raise JMESPathCheckAssertionError(self._query, expected_result_format, 'None',
57+
execution_result.output)
6058

6159

6260
class NoneCheck(object): # pylint: disable=too-few-public-methods

knack/testsdk/recording_processors.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def process_response(self, response):
4949
if length > self._max_response_body * 1024:
5050
response['body']['string'] = \
5151
"!!! The response body has been omitted from the recording because it is larger " \
52-
"than {} KB. It will be replaced with blank content of {} bytes while replay. " \
53-
"{}{}".format(self._max_response_body, length, self.control_flag, length)
52+
"than {max} KB. It will be replaced with blank content of {length} bytes while replay. " \
53+
"{flag}{length}".format(max=self._max_response_body, length=length, flag=self.control_flag)
5454

5555
return response
5656

knack/util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class CLIError(Exception):
2424
normal operation of the CLI.
2525
Typically due to user error and can be resolved by the user.
2626
"""
27-
pass
27+
pass # pylint: disable=unnecessary-pass
2828

2929

3030
class CtxTypeError(TypeError):

requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ colorama==0.3.9
33
flake8==3.2.1
44
jmespath==0.9.2
55
mock==2.0.0
6-
pylint==1.8.4; python_version <= '2.7'
7-
pylint==2.1.1; python_version >= '3.5'
6+
pylint==1.9.4; python_version <= '2.7'
7+
pylint==2.3.1; python_version >= '3.5'
88
pygments==2.2.0
99
pyyaml==3.12
1010
six==1.10.0

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from codecs import open
1010
from setuptools import setup, find_packages
1111

12-
VERSION = '0.5.2'
12+
VERSION = '0.5.3'
1313

1414
DEPENDENCIES = [
1515
'argcomplete',

tests/test_deprecation.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from knack.arguments import ArgumentsContext
1515
from knack.commands import CLICommand, CLICommandsLoader, CommandGroup
1616

17-
from tests.util import TestCLI
17+
from tests.util import DummyCLI
1818

1919

2020
def example_handler(arg1, arg2=None, arg3=None):
@@ -73,7 +73,7 @@ def load_arguments(self, command):
7373
type: group
7474
short-summary: A group.
7575
"""
76-
self.cli_ctx = TestCLI(commands_loader_cls=DeprecationTestCommandLoader)
76+
self.cli_ctx = DummyCLI(commands_loader_cls=DeprecationTestCommandLoader)
7777

7878
@redirect_io
7979
def test_deprecate_command_group_help(self):
@@ -186,7 +186,7 @@ def load_arguments(self, command):
186186
type: group
187187
short-summary: A group.
188188
"""
189-
self.cli_ctx = TestCLI(commands_loader_cls=DeprecationTestCommandLoader)
189+
self.cli_ctx = DummyCLI(commands_loader_cls=DeprecationTestCommandLoader)
190190

191191
@redirect_io
192192
def test_deprecate_command_group_help_plain(self):
@@ -294,7 +294,7 @@ def load_arguments(self, command):
294294
type: group
295295
short-summary: A group.
296296
"""
297-
self.cli_ctx = TestCLI(commands_loader_cls=DeprecationTestCommandLoader)
297+
self.cli_ctx = DummyCLI(commands_loader_cls=DeprecationTestCommandLoader)
298298

299299
@redirect_io
300300
def test_deprecate_arguments_command_help(self):

tests/test_help.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from knack.events import EVENT_PARSER_GLOBAL_CREATE
1616
from knack.invocation import CommandInvoker
1717

18-
from tests.util import MockContext, TestCLI
18+
from tests.util import MockContext, DummyCLI
1919

2020
io = {}
2121

@@ -199,7 +199,7 @@ def load_arguments(self, command):
199199
text: example details
200200
"""
201201

202-
self.cli_ctx = TestCLI(commands_loader_cls=HelpTestCommandLoader)
202+
self.cli_ctx = DummyCLI(commands_loader_cls=HelpTestCommandLoader)
203203

204204
@redirect_io
205205
def test_choice_list_with_ints(self):

tests/util.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ def __init__(self):
2020
setattr(self, 'invocation', invocation)
2121

2222

23-
class TestCLI(CLI):
23+
class DummyCLI(CLI):
2424

2525
def get_cli_version(self):
2626
return '0.1.0'
2727

2828
def __init__(self, **kwargs):
2929
kwargs['config_dir'] = tempfile.mkdtemp()
30-
super(TestCLI, self).__init__(**kwargs)
30+
super(DummyCLI, self).__init__(**kwargs)

0 commit comments

Comments
 (0)