Make pylint a little happier

Import ordering, parenthesis and docstring adjustments.
This commit is contained in:
Chris Dent 2016-05-07 14:00:37 +01:00
parent c4ba2254cb
commit e31f9b4f62
6 changed files with 21 additions and 8 deletions

View File

@ -208,7 +208,7 @@ def build_tests(path, loader, host=None, port=8001, intercept=None,
# Exit immediately if we have no host to access, either via a real host
# or an intercept.
if not (bool(host) ^ bool(intercept)):
if not bool(host) ^ bool(intercept):
raise AssertionError('must specify exactly one of host or intercept')
if test_loader_name is None:

View File

@ -28,6 +28,11 @@ urllib3.disable_warnings()
class Http(urllib3.PoolManager):
"""A subclass of the urllib3.PoolManager to munge the data.
This transforms the response to look more like what httplib2
provided when it was used as the httpclient.
"""
def request(self, absolute_uri, method, body, headers, redirect):
if redirect:

View File

@ -19,6 +19,7 @@ PARSER = None
def parse(path):
"""Parse a JSONPath expression use the global parser."""
global PARSER
if not PARSER:
PARSER = parser.ExtentedJsonPathParser()

View File

@ -104,6 +104,13 @@ class ConciseTestResult(TextTestResult):
class PyTestResult(TestResult):
"""Wrap a test result to allow it to work with pytest.
The main behaviors here are:
* to turn what had been exceptions back into exceptions
* use pytest's skip and xfail methods
"""
def addFailure(self, test, err):
raise err[1]

View File

@ -13,13 +13,12 @@
"""Implementation of a command-line runner of single gabbi files."""
import argparse
from importlib import import_module
import sys
import unittest
import yaml
from importlib import import_module
from six.moves.urllib import parse as urlparse
import yaml
from gabbi import case
from gabbi import driver
@ -107,7 +106,7 @@ def run():
# Initialize response handlers.
custom_response_handlers = []
for import_path in (args.response_handlers or []):
for import_path in args.response_handlers or []:
for handler in load_response_handlers(import_path):
custom_response_handlers.append(handler)
for handler in driver.RESPONSE_HANDLERS + custom_response_handlers:

View File

@ -14,9 +14,6 @@
import os
import colorama
from six.moves.urllib import parse as urlparse
try: # Python 3
ConnectionRefused = ConnectionRefusedError
@ -25,6 +22,10 @@ except NameError: # Python 2
ConnectionRefused = socket.error
import colorama
from six.moves.urllib import parse as urlparse
def create_url(base_url, host, port=None, prefix='', ssl=False):
"""Given pieces of a path-based url, return a fully qualified url."""
scheme = 'http'