-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
One of my test files (https://github.com/nedbat/coveragepy/blob/coverage-5.4/tests/test_testing.py) was converted into invalid code. I don't know what it is about that file that caused it, though it is a bit twisty: it's a test of test assert helper methods.
Here is a stripped-down file that shows the same behavior:
import pytest
from coverage.backunittest import TestCase
class TestingTest(TestCase):
"""Tests of helper methods on `backunittest.TestCase`."""
def test_assert_count_equal(self):
self.assertCountEqual(set(), set())
with self.assertRaises(AssertionError):
self.assertCountEqual({1,2,3}, set())
with self.assertRaises(AssertionError):
self.assertCountEqual({1,2,3}, {4,5,6})
Running unittest2pytest -w test_testing.py, the file becomes:
import pytest
from coverage.backunittest import TestCase
"""Tests of helper methods on `backunittest.TestCase`."""
deftest_assert_count_equal(self):
self.assertCountEqual(set(), set())
with pytest.raises(AssertionError):
self.assertCountEqual({1,2,3}, set())
withpytest.raises(AssertionError):
self.assertCountEqual({1,2,3}, {4,5,6})
Metadata
Metadata
Assignees
Labels
No labels