Remove references to self in the function parameters
Use regular expressions to search and replace assertions:
self.assertEqual(x, y) -> assert x == y
self.assertRaises -> pytest.raises
self.assertFalse(x) -> assert x is False
self.assertIn(x, y) -> assert x in y
Some long strings were wrapped to prepare for the possibility of using code formatters in the future.
STDOUT capture code was replaced with the pytest capsys fixture, which simplified the code in test_ATR.py.
This PR prepares for the possibility of consolidating the live tests in src/smartcard/test/ together with the overall test suite, and using pytest features to control whether the live tests run or not.
This is only a possibility, not a guarantee, but migrating from unittest code to pytest code helps pave the way.
coverage: 60.337% (+0.3%) from 60.037%
when pulling a9beece89cb61e5524adfeddb772423e59b07e4f on kurtmckee:migrate-to-pytest
into 1baa8ea356eb2f6ab682396fcbe49266ff50f03c on LudovicRousseau:master.
This PR introduces the following changes:
test_Exceptions.py
:test_ListReadersException
. The duplicate tests have been merged.Most of this work was mechanical:
unittest.TestCase
subclass definition linesself
in the function parametersself.assertEqual(x, y)
->assert x == y
self.assertRaises
->pytest.raises
self.assertFalse(x)
->assert x is False
self.assertIn(x, y)
->assert x in y
Some long strings were wrapped to prepare for the possibility of using code formatters in the future.
STDOUT capture code was replaced with the pytest
capsys
fixture, which simplified the code intest_ATR.py
.This PR prepares for the possibility of consolidating the live tests in
src/smartcard/test/
together with the overall test suite, and using pytest features to control whether the live tests run or not.This is only a possibility, not a guarantee, but migrating from unittest code to pytest code helps pave the way.