Esempio n. 1
0
def test_uses_flake8_util_stdin(pep8_mod, pycodestyle_mod):
    """Verify we monkey-patch using internal flake8 functions."""
    import flake8.utils

    stdin.monkey_patch('all')
    assert pep8_mod.stdin_get_value is flake8.utils.stdin_get_value
    assert pycodestyle_mod.stdin_get_value is flake8.utils.stdin_get_value
Esempio n. 2
0
def test_uses_flake8_util_stdin(pep8_mod, pycodestyle_mod):
    """Verify we monkey-patch using internal flake8 functions."""
    import flake8.utils

    stdin.monkey_patch('all')
    assert pep8_mod.stdin_get_value is flake8.utils.stdin_get_value
    assert pycodestyle_mod.stdin_get_value is flake8.utils.stdin_get_value
Esempio n. 3
0
# -*- coding: utf-8 -*-
from difflib import Differ
from flake8_polyfill import stdin
from isort import SortImports
from testfixtures import OutputCapture

import os
import pycodestyle

try:
    from configparser import ConfigParser
except ImportError:
    from ConfigParser import ConfigParser

stdin.monkey_patch('pycodestyle')


class Flake8Isort(object):
    name = 'flake8_isort'
    version = '2.1.1'
    isort_unsorted = ('I001 isort found an import in the wrong position')
    no_config_msg = (
        'I002 no configuration found (.isort.cfg or [isort] on setup.cfg)')
    isort_blank_req = ('I003 isort expected 1 blank line in imports, found 0')
    isort_blank_unexp = (
        'I004 isort found an unexpected blank line in imports')

    config_file = None

    def __init__(self, tree, filename):
        self.filename = filename
Esempio n. 4
0
def test_monkey_patch_pycodestyle(pycodestyle_mod):
    """Verify we monkey patch pycodestyle only."""
    stdin.monkey_patch('pycodestyle')
    assert pep8.stdin_get_value is not pycodestyle_mod.stdin_get_value
Esempio n. 5
0
def test_monkey_patch_pep8(pep8_mod):
    """Verify we monkey patch pep8 only."""
    stdin.monkey_patch('pep8')
    assert pep8_mod.stdin_get_value is not pycodestyle.stdin_get_value
Esempio n. 6
0
def test_monkey_patch_all(pep8_mod, pycodestyle_mod):
    """Verify we monkey patch everything."""
    stdin.monkey_patch('all')
    assert pep8_mod.stdin_get_value is pycodestyle_mod.stdin_get_value
"""
import sys

from flake8_polyfill import stdin
import pycodestyle
try:
    import pydocstyle as pep257
    module_name = 'pydocstyle'
except ImportError:
    import pep257
    module_name = 'pep257'

__version__ = '1.0.2'
__all__ = ('pep257Checker',)

stdin.monkey_patch('pycodestyle')


class EnvironError(pep257.Error):
    code = 'D998'
    context = None

    @property
    def short_desc(self):
        return sys.exc_info()[1]


class AllError(pep257.Error):
    code = 'D999'
    short_desc = '__all__ was found to be a list or other mutable collection'
    context = None
Esempio n. 8
0
def test_monkey_patch_pycodestyle(pycodestyle_mod):
    """Verify we monkey patch pycodestyle only."""
    stdin.monkey_patch('pycodestyle')
    assert pep8.stdin_get_value is not pycodestyle_mod.stdin_get_value
Esempio n. 9
0
def test_monkey_patch_pep8(pep8_mod):
    """Verify we monkey patch pep8 only."""
    stdin.monkey_patch('pep8')
    assert pep8_mod.stdin_get_value is not pycodestyle.stdin_get_value
Esempio n. 10
0
def test_monkey_patch_all(pep8_mod, pycodestyle_mod):
    """Verify we monkey patch everything."""
    stdin.monkey_patch('all')
    assert pep8_mod.stdin_get_value is pycodestyle_mod.stdin_get_value