|
@@ 79-90 (lines=12) @@
|
| 76 |
|
] |
| 77 |
|
|
| 78 |
|
|
| 79 |
|
@pytest.mark.skipif(sys.version_info < (3,), reason="requires Python 3") |
| 80 |
|
@patch.object(pyclean.modern.logging, 'basicConfig') |
| 81 |
|
@patch('pyclean.modern.descend_and_clean_bytecode') |
| 82 |
|
def test_quiet_logging(mock_descend, mock_logconfig): |
| 83 |
|
""" |
| 84 |
|
Does --quiet use log level FATAL? |
| 85 |
|
""" |
| 86 |
|
with ArgvContext('pyclean', '.', '--quiet'): |
| 87 |
|
pyclean.cli.main() |
| 88 |
|
|
| 89 |
|
assert mock_logconfig.mock_calls == [ |
| 90 |
|
call(format='%(message)s', level=logging.FATAL), |
| 91 |
|
] |
| 92 |
|
|
| 93 |
|
|
|
@@ 64-75 (lines=12) @@
|
| 61 |
|
] |
| 62 |
|
|
| 63 |
|
|
| 64 |
|
@pytest.mark.skipif(sys.version_info < (3,), reason="requires Python 3") |
| 65 |
|
@patch.object(pyclean.modern.logging, 'basicConfig') |
| 66 |
|
@patch('pyclean.modern.descend_and_clean_bytecode') |
| 67 |
|
def test_verbose_logging(mock_descend, mock_logconfig): |
| 68 |
|
""" |
| 69 |
|
Does --verbose use log level DEBUG? |
| 70 |
|
""" |
| 71 |
|
with ArgvContext('pyclean', '.', '--verbose'): |
| 72 |
|
pyclean.cli.main() |
| 73 |
|
|
| 74 |
|
assert mock_logconfig.mock_calls == [ |
| 75 |
|
call(format='%(message)s', level=logging.DEBUG), |
| 76 |
|
] |
| 77 |
|
|
| 78 |
|
|
|
@@ 49-60 (lines=12) @@
|
| 46 |
|
] |
| 47 |
|
|
| 48 |
|
|
| 49 |
|
@pytest.mark.skipif(sys.version_info < (3,), reason="requires Python 3") |
| 50 |
|
@patch.object(pyclean.modern.logging, 'basicConfig') |
| 51 |
|
@patch('pyclean.modern.descend_and_clean_bytecode') |
| 52 |
|
def test_normal_logging(mock_descend, mock_logconfig): |
| 53 |
|
""" |
| 54 |
|
Does a normal run use log level INFO? |
| 55 |
|
""" |
| 56 |
|
with ArgvContext('pyclean', '.'): |
| 57 |
|
pyclean.cli.main() |
| 58 |
|
|
| 59 |
|
assert mock_logconfig.mock_calls == [ |
| 60 |
|
call(format='%(message)s', level=logging.INFO), |
| 61 |
|
] |
| 62 |
|
|
| 63 |
|
|