|
@@ 113-129 (lines=17) @@
|
| 110 |
|
assert not mock_dry_rmdir.called |
| 111 |
|
|
| 112 |
|
|
| 113 |
|
@pytest.mark.skipif(sys.version_info < (3,), reason="requires Python 3") |
| 114 |
|
@patch('pyclean.modern.print_dirname') |
| 115 |
|
@patch('pyclean.modern.print_filename') |
| 116 |
|
@patch('pyclean.modern.remove_directory') |
| 117 |
|
@patch('pyclean.modern.remove_file') |
| 118 |
|
def test_dryrun(mock_real_unlink, mock_real_rmdir, |
| 119 |
|
mock_dry_unlink, mock_dry_rmdir): |
| 120 |
|
""" |
| 121 |
|
Does --dry-run option avoid real deletion? |
| 122 |
|
""" |
| 123 |
|
with ArgvContext('pyclean', '.', '--dry-run'): |
| 124 |
|
pyclean.cli.main() |
| 125 |
|
|
| 126 |
|
assert not mock_real_unlink.called |
| 127 |
|
assert not mock_real_rmdir.called |
| 128 |
|
assert mock_dry_unlink.called |
| 129 |
|
assert mock_dry_rmdir.called |
| 130 |
|
|
|
@@ 94-110 (lines=17) @@
|
| 91 |
|
] |
| 92 |
|
|
| 93 |
|
|
| 94 |
|
@pytest.mark.skipif(sys.version_info < (3,), reason="requires Python 3") |
| 95 |
|
@patch('pyclean.modern.print_dirname') |
| 96 |
|
@patch('pyclean.modern.print_filename') |
| 97 |
|
@patch('pyclean.modern.remove_directory') |
| 98 |
|
@patch('pyclean.modern.remove_file') |
| 99 |
|
def test_delete(mock_real_unlink, mock_real_rmdir, |
| 100 |
|
mock_dry_unlink, mock_dry_rmdir): |
| 101 |
|
""" |
| 102 |
|
Is actual deletion attempted w/o --dry-run? |
| 103 |
|
""" |
| 104 |
|
with ArgvContext('pyclean', '.'): |
| 105 |
|
pyclean.cli.main() |
| 106 |
|
|
| 107 |
|
assert mock_real_unlink.called |
| 108 |
|
assert mock_real_rmdir.called |
| 109 |
|
assert not mock_dry_unlink.called |
| 110 |
|
assert not mock_dry_rmdir.called |
| 111 |
|
|
| 112 |
|
|
| 113 |
|
@pytest.mark.skipif(sys.version_info < (3,), reason="requires Python 3") |