Commits

Ronny Pfannschmidt committed 4e1175a

tests for pep8

  • Participants
  • Parent commits 09df4ad

Comments (0)

Files changed (1)

tests/test_pep8.py

+def pytest_funcarg__testdir(request):
+    testdir = request.getfuncargvalue('testdir')
+    testdir.makeini('[pytest]\ncodechecks = pep8')
+    return testdir
+
+
+def test_badcode(testdir):
+    testdir.makepyfile('''
+        def a():
+            pass
+        def b():
+            pass''')
+    out = testdir.runpytest('--tb=short', '-v')
+    out.stdout.fnmatch_lines([
+        '*lines*',
+        '*1 failed*',
+    ])
+
+
+def test_goodcode(testdir):
+    p = testdir.makepyfile('''
+        def a():
+            pass
+
+
+        def b():
+            pass
+
+        ''')
+    p.write(p.read() + '\n')
+    out = testdir.runpytest('--tb=short', '-v')
+    out.stdout.fnmatch_lines([
+        '*1 passed*',
+    ])