|
10 | 10 | import stat |
11 | 11 | from plumbum import local |
12 | 12 |
|
13 | | -from pre_commit.commands.install import install |
14 | | -from pre_commit.commands.install import is_our_pre_commit |
15 | | -from pre_commit.commands.install import make_executable |
| 13 | +from pre_commit.commands.install_uninstall import install |
| 14 | +from pre_commit.commands.install_uninstall import is_our_pre_commit |
| 15 | +from pre_commit.commands.install_uninstall import make_executable |
| 16 | +from pre_commit.commands.install_uninstall import uninstall |
16 | 17 | from pre_commit.runner import Runner |
17 | 18 | from testing.fixtures import git_dir |
18 | 19 | from testing.fixtures import make_consuming_repo |
@@ -46,6 +47,23 @@ def test_install_pre_commit(tmpdir_factory): |
46 | 47 | assert stat_result.st_mode & (stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH) |
47 | 48 |
|
48 | 49 |
|
| 50 | +def test_uninstall_does_not_blow_up_when_not_there(tmpdir_factory): |
| 51 | + path = git_dir(tmpdir_factory) |
| 52 | + runner = Runner(path) |
| 53 | + ret = uninstall(runner) |
| 54 | + assert ret == 0 |
| 55 | + |
| 56 | + |
| 57 | +def test_uninstall(tmpdir_factory): |
| 58 | + path = git_dir(tmpdir_factory) |
| 59 | + runner = Runner(path) |
| 60 | + assert not os.path.exists(runner.pre_commit_path) |
| 61 | + install(runner) |
| 62 | + assert os.path.exists(runner.pre_commit_path) |
| 63 | + uninstall(runner) |
| 64 | + assert not os.path.exists(runner.pre_commit_path) |
| 65 | + |
| 66 | + |
49 | 67 | def _get_commit_output(tmpdir_factory, touch_file='foo'): |
50 | 68 | local['touch'](touch_file) |
51 | 69 | local['git']('add', touch_file) |
|
0 commit comments