def test_args_parser_version(capsys): version = '7.7.7' with mock.patch('pyaspeller.__version__', version): with pytest.raises(SystemExit): main() out, err = capsys.readouterr() assert version in out, "Bad version: " + out
def test_main_checks_python_version(self): old_check_version = pyaspeller.check_version pyaspeller.check_version = mock.Mock() pyaspeller.main() self.assertTrue(pyaspeller.check_version.called, "main must check version") pyaspeller.check_version = old_check_version