Fixed E302 flake8 errors

expected 2 blank lines, found 0
This commit is contained in:
Andras Tim
2017-07-17 01:25:09 +02:00
parent 17a21d540b
commit b840622819
56 changed files with 423 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ from _pytest.main import EXIT_NOTESTSCOLLECTED
import pytest
import gc
def test_simple_unittest(testdir):
testpath = testdir.makepyfile("""
import unittest
@@ -16,6 +17,7 @@ def test_simple_unittest(testdir):
assert reprec.matchreport("testpassing").passed
assert reprec.matchreport("test_failing").failed
def test_runTest_method(testdir):
testdir.makepyfile("""
import unittest
@@ -35,6 +37,7 @@ def test_runTest_method(testdir):
*2 passed*
""")
def test_isclasscheck_issue53(testdir):
testpath = testdir.makepyfile("""
import unittest
@@ -46,6 +49,7 @@ def test_isclasscheck_issue53(testdir):
result = testdir.runpytest(testpath)
assert result.ret == EXIT_NOTESTSCOLLECTED
def test_setup(testdir):
testpath = testdir.makepyfile("""
import unittest
@@ -66,6 +70,7 @@ def test_setup(testdir):
rep = reprec.matchreport("test_both", when="teardown")
assert rep.failed and '42' in str(rep.longrepr)
def test_setUpModule(testdir):
testpath = testdir.makepyfile("""
l = []
@@ -87,6 +92,7 @@ def test_setUpModule(testdir):
"*2 passed*",
])
def test_setUpModule_failing_no_teardown(testdir):
testpath = testdir.makepyfile("""
l = []
@@ -105,6 +111,7 @@ def test_setUpModule_failing_no_teardown(testdir):
call = reprec.getcalls("pytest_runtest_setup")[0]
assert not call.item.module.l
def test_new_instances(testdir):
testpath = testdir.makepyfile("""
import unittest
@@ -117,6 +124,7 @@ def test_new_instances(testdir):
reprec = testdir.inline_run(testpath)
reprec.assertoutcome(passed=2)
def test_teardown(testdir):
testpath = testdir.makepyfile("""
import unittest
@@ -136,6 +144,7 @@ def test_teardown(testdir):
assert passed == 2
assert passed + skipped + failed == 2
def test_teardown_issue1649(testdir):
"""
Are TestCase objects cleaned up? Often unittest TestCase objects set
@@ -158,6 +167,7 @@ def test_teardown_issue1649(testdir):
for obj in gc.get_objects():
assert type(obj).__name__ != 'TestCaseObjectsShouldBeCleanedUp'
@pytest.mark.skipif("sys.version_info < (2,7)")
def test_unittest_skip_issue148(testdir):
testpath = testdir.makepyfile("""
@@ -177,6 +187,7 @@ def test_unittest_skip_issue148(testdir):
reprec = testdir.inline_run(testpath)
reprec.assertoutcome(skipped=1)
def test_method_and_teardown_failing_reporting(testdir):
testdir.makepyfile("""
import unittest, pytest
@@ -196,6 +207,7 @@ def test_method_and_teardown_failing_reporting(testdir):
"*1 failed*1 error*",
])
def test_setup_failure_is_shown(testdir):
testdir.makepyfile("""
import unittest
@@ -216,6 +228,7 @@ def test_setup_failure_is_shown(testdir):
])
assert 'never42' not in result.stdout.str()
def test_setup_setUpClass(testdir):
testpath = testdir.makepyfile("""
import unittest
@@ -238,6 +251,7 @@ def test_setup_setUpClass(testdir):
reprec = testdir.inline_run(testpath)
reprec.assertoutcome(passed=3)
def test_setup_class(testdir):
testpath = testdir.makepyfile("""
import unittest
@@ -279,6 +293,7 @@ def test_testcase_adderrorandfailure_defers(testdir, type):
result = testdir.runpytest()
assert 'should not raise' not in result.stdout.str()
@pytest.mark.parametrize("type", ['Error', 'Failure'])
def test_testcase_custom_exception_info(testdir, type):
testdir.makepyfile("""
@@ -310,6 +325,7 @@ def test_testcase_custom_exception_info(testdir, type):
"*1 failed*",
])
def test_testcase_totally_incompatible_exception_info(testdir):
item, = testdir.getitems("""
from unittest import TestCase
@@ -321,6 +337,7 @@ def test_testcase_totally_incompatible_exception_info(testdir):
excinfo = item._excinfo.pop(0)
assert 'ERROR: Unknown Incompatible' in str(excinfo.getrepr())
def test_module_level_pytestmark(testdir):
testpath = testdir.makepyfile("""
import unittest
@@ -520,6 +537,7 @@ class TestTrialUnittest(object):
child.expect("hellopdb")
child.sendeof()
def test_djangolike_testcase(testdir):
# contributed from Morten Breekevold
testdir.makepyfile("""
@@ -585,6 +603,7 @@ def test_unittest_not_shown_in_traceback(testdir):
res = testdir.runpytest()
assert "failUnlessEqual" not in res.stdout.str()
def test_unorderable_types(testdir):
testdir.makepyfile("""
import unittest
@@ -602,6 +621,7 @@ def test_unorderable_types(testdir):
assert "TypeError" not in result.stdout.str()
assert result.ret == EXIT_NOTESTSCOLLECTED
def test_unittest_typerror_traceback(testdir):
testdir.makepyfile("""
import unittest
@@ -769,6 +789,7 @@ def test_issue333_result_clearing(testdir):
reprec = testdir.inline_run()
reprec.assertoutcome(failed=1)
@pytest.mark.skipif("sys.version_info < (2,7)")
def test_unittest_raise_skip_issue748(testdir):
testdir.makepyfile(test_foo="""
@@ -784,6 +805,7 @@ def test_unittest_raise_skip_issue748(testdir):
*1 skipped*
""")
@pytest.mark.skipif("sys.version_info < (2,7)")
def test_unittest_skip_issue1169(testdir):
testdir.makepyfile(test_foo="""
@@ -800,6 +822,7 @@ def test_unittest_skip_issue1169(testdir):
*1 skipped*
""")
def test_class_method_containing_test_issue1558(testdir):
testdir.makepyfile(test_foo="""
import unittest