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
  File "/usr/local/lib/python3.5/dist-packages/osmopython-0.2.0-py3.5.egg/EGG-INFO/scripts/", line 142, in remove_tmpdir
    os.unlink(os.path.join(tmpdir, f))
IsADirectoryError: [Errno 21] Is a directory: 'writtenconfig/ericsson'

Change-Id: I896b99032d94ba0cdd340a8eed7c7b625661ad69
Harald Welte 2020-07-15 08:53:10 +02:00
parent 4a7a208ce0
commit be7fcf5f28
1 changed files with 2 additions and 4 deletions

View File

@ -15,6 +15,7 @@
# along with this program. If not, see <>.
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))
def check_configs_tested(basedir, app_configs, ignore_configs):