remove_tmpdir(): Support recursion / sub-directories
The existing code assumed that tmpdir only contained regular files, not an entire hierarchy of files with sub-directories or the like. In case sub-directories exist, the current code fails as follows: line 176, in test_all_apps remove_tmpdir(tmpdir) File "/usr/local/lib/python3.5/dist-packages/osmopython-0.2.0-py3.5.egg/EGG-INFO/scripts/osmotestconfig.py", line 142, in remove_tmpdir os.unlink(os.path.join(tmpdir, f)) IsADirectoryError: [Errno 21] Is a directory: 'writtenconfig/ericsson' Change-Id: I896b99032d94ba0cdd340a8eed7c7b625661ad69changes/67/19267/1
parent
4a7a208ce0
commit
be7fcf5f28
|
@ -15,6 +15,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
import os
|
||||
import os.path
|
||||
import shutil
|
||||
import time
|
||||
import sys, shutil, stat
|
||||
import tempfile
|
||||
|
@ -137,10 +138,7 @@ def app_exists(app_desc):
|
|||
|
||||
|
||||
def remove_tmpdir(tmpdir):
|
||||
files = os.listdir(tmpdir)
|
||||
for f in files:
|
||||
os.unlink(os.path.join(tmpdir, f))
|
||||
os.rmdir(tmpdir)
|
||||
shutil.rmtree(tmpdir)
|
||||
|
||||
|
||||
def check_configs_tested(basedir, app_configs, ignore_configs):
|
||||
|
|
Loading…
Reference in New Issue