Use shutil.rmtree in tests
This commit is contained in:
parent
0ee5293e1a
commit
560600fca9
|
@ -4,6 +4,7 @@ from __future__ import division
|
|||
import threading
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
|
||||
from time import sleep
|
||||
from subprocess import call, PIPE
|
||||
|
@ -581,12 +582,7 @@ class TestVCS(TestCase):
|
|||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
for repo_dir in [GIT_REPO] + ([HG_REPO] if use_mercurial else []) + ([BZR_REPO] if use_bzr else []):
|
||||
for root, dirs, files in list(os.walk(repo_dir, topdown=False)):
|
||||
for file in files:
|
||||
os.remove(os.path.join(root, file))
|
||||
for dir in dirs:
|
||||
os.rmdir(os.path.join(root, dir))
|
||||
os.rmdir(repo_dir)
|
||||
shutil.rmtree(repo_dir)
|
||||
if use_mercurial:
|
||||
if cls.powerline_old_HGRCPATH is None:
|
||||
os.environ.pop('HGRCPATH')
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
# vim:fileencoding=utf-8:noet
|
||||
from __future__ import absolute_import, unicode_literals, print_function, division
|
||||
|
||||
import shutil
|
||||
import os
|
||||
|
||||
from time import sleep
|
||||
from functools import partial
|
||||
|
||||
from powerline.lib.watcher import create_file_watcher, create_tree_watcher, INotifyError
|
||||
from powerline.lib.watcher.uv import UvNotFound
|
||||
from powerline import get_fallback_logger
|
||||
from powerline.lib.monotonic import monotonic
|
||||
|
||||
import shutil
|
||||
from time import sleep
|
||||
from functools import partial
|
||||
import os
|
||||
|
||||
from tests import TestCase, SkipTest
|
||||
|
||||
|
||||
|
@ -150,9 +151,7 @@ def setUpModule():
|
|||
|
||||
|
||||
def tearDownModule():
|
||||
for d in [INOTIFY_DIR]:
|
||||
clear_dir(d)
|
||||
os.rmdir(d)
|
||||
shutil.rmtree(INOTIFY_DIR)
|
||||
os.chdir(old_cwd)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue