diff --git a/pytest.py b/pytest.py index 161c44822..e1d12d163 100644 --- a/pytest.py +++ b/pytest.py @@ -2,7 +2,14 @@ """ pytest: unit and functional testing with Python. """ -__all__ = ['main'] +__all__ = [ + 'main', + 'UsageError', + 'cmdline', + 'hookspec', + 'hookimpl', + '__version__', +] if __name__ == '__main__': # if run as a script or by 'python -m pytest' # we trigger the below "else" condition by the following import diff --git a/testing/test_cache.py b/testing/test_cache.py index c4c2c3e78..9ec8966d7 100755 --- a/testing/test_cache.py +++ b/testing/test_cache.py @@ -1,7 +1,4 @@ -import os import pytest -import shutil -import py pytest_plugins = "pytester", @@ -57,7 +54,7 @@ class TestNewAPI: def test_cache_reportheader(testdir): - p = testdir.makepyfile(""" + testdir.makepyfile(""" def test_hello(): pass """) @@ -72,7 +69,7 @@ def test_cache_show(testdir): result.stdout.fnmatch_lines([ "*cache is empty*" ]) - p = testdir.makeconftest(""" + testdir.makeconftest(""" def pytest_configure(config): config.cache.set("my/name", [1,2,3]) config.cache.set("other/some", {1:2}) diff --git a/testing/test_lastfailed.py b/testing/test_lastfailed.py index 35ecd9a13..445d81be0 100755 --- a/testing/test_lastfailed.py +++ b/testing/test_lastfailed.py @@ -54,11 +54,11 @@ class TestLastFailed: ]) def test_failedfirst_order(self, testdir): - always_pass = testdir.tmpdir.join('test_a.py').write(py.code.Source(""" + testdir.tmpdir.join('test_a.py').write(py.code.Source(""" def test_always_passes(): assert 1 """)) - always_fail = testdir.tmpdir.join('test_b.py').write(py.code.Source(""" + testdir.tmpdir.join('test_b.py').write(py.code.Source(""" def test_always_fails(): assert 0 """)) @@ -114,7 +114,7 @@ class TestLastFailed: @pytest.mark.skipif("sys.version_info < (2,6)") def test_lastfailed_usecase_splice(self, testdir, monkeypatch): monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1) - p1 = testdir.makepyfile(""" + testdir.makepyfile(""" def test_1(): assert 0 """) @@ -137,7 +137,7 @@ class TestLastFailed: ]) def test_lastfailed_xpass(self, testdir): - rep = testdir.inline_runsource(""" + testdir.inline_runsource(""" import pytest @pytest.mark.xfail def test_hello(): diff --git a/tox.ini b/tox.ini index 73ecdfb45..be04e0a0a 100644 --- a/tox.ini +++ b/tox.ini @@ -33,8 +33,8 @@ commands= py.test --genscript=pytest1 [testenv:flakes] basepython = python2.7 -deps = pytest-flakes>=0.2 -commands = py.test --flakes -m flakes _pytest testing +deps = flake8 +commands = flake8 pytest.py _pytest testing [testenv:py27-xdist] deps=pytest-xdist>=1.13 @@ -148,5 +148,8 @@ rsyncdirs=tox.ini pytest.py _pytest testing python_files=test_*.py *_test.py testing/*/*.py python_classes=Test Acceptance python_functions=test -pep8ignore = E401 E225 E261 E128 E124 E302 norecursedirs = .tox ja .hg cx_freeze_source + + +[flake8] +ignore =E401,E225,E261,E128,E124,E301,E302,E121,E303,W391,E501,E231,E126,E701,E265,E241,E251,E226,E101,W191,E131,E203,E122,E123,E271,E712,E222,E127,E125,E221,W292,E111,E113,E293,E262,W293,E129,E702,E201,E272,E202