Merge pull request #2596 from nicoddemus/autopep-tox
Add "fix-lint" tox environment
This commit is contained in:
commit
ccc4b3a501
|
@ -212,7 +212,12 @@ but here is a simple overview:
|
|||
$ tox -e linting,py27,py36
|
||||
|
||||
This command will run tests via the "tox" tool against Python 2.7 and 3.6
|
||||
and also perform "lint" coding-style checks.
|
||||
and also perform "lint" coding-style checks. If you have too much linting errors,
|
||||
try running::
|
||||
|
||||
$ tox -e fix-lint
|
||||
|
||||
To fix pep8 related errors.
|
||||
|
||||
#. You can now edit your local working copy.
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Add missing ``encoding`` attribute to ``sys.std*`` streams when using ``capsys`` capture mode.
|
|
@ -1 +0,0 @@
|
|||
Provides encoding attribute on CaptureIO.
|
|
@ -1 +1 @@
|
|||
Renamed the utility function `_pytest.compat._escape_strings` to `_ascii_escaped` to better communicate the function's purpose.
|
||||
Renamed the utility function ``_pytest.compat._escape_strings`` to ``_ascii_escaped`` to better communicate the function's purpose.
|
||||
|
|
|
@ -1 +1 @@
|
|||
Emit yield test warning only once per generator
|
||||
Emit warning about ``yield`` tests being deprecated only once per generator.
|
||||
|
|
|
@ -1 +1 @@
|
|||
The options --fixtures and --fixtures-per-test will now keep indentation within docstrings.
|
||||
The options ```--fixtures`` and ```--fixtures-per-test`` will now keep indentation within docstrings.
|
||||
|
|
|
@ -1 +1 @@
|
|||
Fixed all flake8 errors and warnings
|
||||
Fixed all flake8 errors and warnings.
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Added ``fix-lint`` tox environment to run automatic pep8 fixes on the code.
|
|
@ -335,21 +335,6 @@ def test_getstartingblock_singleline():
|
|||
assert len(l) == 1
|
||||
|
||||
|
||||
def test_getstartingblock_multiline():
|
||||
class A(object):
|
||||
def __init__(self, *args):
|
||||
frame = sys._getframe(1)
|
||||
self.source = _pytest._code.Frame(frame).statement
|
||||
|
||||
x = A('x',
|
||||
'y'
|
||||
,
|
||||
'z')
|
||||
|
||||
l = [i for i in x.source.lines if i.strip()]
|
||||
assert len(l) == 4
|
||||
|
||||
|
||||
def test_getline_finally():
|
||||
def c(): pass
|
||||
excinfo = pytest.raises(TypeError, """
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
# flake8: noqa
|
||||
import sys
|
||||
|
||||
import _pytest._code
|
||||
|
||||
|
||||
def test_getstartingblock_multiline():
|
||||
"""
|
||||
This test was originally found in test_source.py, but it depends on the weird
|
||||
formatting of the ``x = A`` construct seen here and our autopep8 tool can only exclude entire
|
||||
files (it does not support excluding lines/blocks using the traditional #noqa comment yet,
|
||||
see hhatto/autopep8#307). It was considered better to just move this single test to its own
|
||||
file and exclude it from autopep8 than try to complicate things.
|
||||
"""
|
||||
class A(object):
|
||||
def __init__(self, *args):
|
||||
frame = sys._getframe(1)
|
||||
self.source = _pytest._code.Frame(frame).statement
|
||||
|
||||
x = A('x',
|
||||
'y'
|
||||
,
|
||||
'z')
|
||||
|
||||
l = [i for i in x.source.lines if i.strip()]
|
||||
assert len(l) == 4
|
|
@ -288,7 +288,7 @@ class TestLoggingInteraction(object):
|
|||
stream.close() # to free memory/release resources
|
||||
""")
|
||||
result = testdir.runpytest_subprocess(p)
|
||||
result.stderr.str().find("atexit") == -1
|
||||
assert result.stderr.str().find("atexit") == -1
|
||||
|
||||
def test_logging_and_immediate_setupteardown(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
|
|
8
tox.ini
8
tox.ini
|
@ -149,6 +149,14 @@ commands =
|
|||
rm -rf /tmp/doc-exec*
|
||||
make regen
|
||||
|
||||
[testenv:fix-lint]
|
||||
skipsdist = True
|
||||
usedevelop = True
|
||||
deps =
|
||||
autopep8
|
||||
commands =
|
||||
autopep8 --in-place -r --max-line-length=120 --exclude=vendored_packages,test_source_multiline_block.py _pytest testing
|
||||
|
||||
[testenv:jython]
|
||||
changedir = testing
|
||||
commands =
|
||||
|
|
Loading…
Reference in New Issue