use pytest.raises() instead of unittest-style '{assertion}'
Bad code:
import unittest
class TestFoo(unittest.TestCase):
def test_foo(self):
with self.assertRaises(ValueError):
raise ValueError('foo')
Good code:
import pytest
import unittest
class TestFoo(unittest.TestCase):
def test_foo(self):
with pytest.raises(ValueError):
raise ValueError('foo')
- to enforce the assertion style recommended by pytest