PY-23856: Support tests with docstring and spaces in target

* Targets are trimmed
* When unittest reports test with docstring it should be part of name, but not location
This commit is contained in:
Ilya.Kazakevich
2017-04-21 19:09:40 +03:00
parent 66cce38e53
commit 56e741a29a
8 changed files with 164 additions and 35 deletions
@@ -0,0 +1,6 @@
def test_evens():
for i in range(0, 5):
yield check_even, i, i*3
def check_even(n, nn):
assert n % 2 == 0 or nn % 2 == 0
@@ -0,0 +1,8 @@
import pytest
@pytest.mark.parametrize("test_input,expected", [
("three plus file", 8),
("(2)+(4)", 6),
(" six times nine.", 42),
])
def test_eval(test_input, expected):
assert eval(test_input) == expected
@@ -0,0 +1,10 @@
from unittest import TestCase
class SomeTestCase(TestCase):
def testSomething(self):
""" Only with docstring test is parsed with extra space"""
self.assertEqual(1 + 1, 2)
def testSomethingBad(self):
"""Fail"""
self.assertEqual(1 + 1, 3)