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: I896b99032d94ba0cdd340a8eed7c7b625661ad69
This commit is contained in:
parent
4a7a208ce0
commit
be7fcf5f28
|
@ -15,6 +15,7 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
import shutil
|
||||||
import time
|
import time
|
||||||
import sys, shutil, stat
|
import sys, shutil, stat
|
||||||
import tempfile
|
import tempfile
|
||||||
|
@ -137,10 +138,7 @@ def app_exists(app_desc):
|
||||||
|
|
||||||
|
|
||||||
def remove_tmpdir(tmpdir):
|
def remove_tmpdir(tmpdir):
|
||||||
files = os.listdir(tmpdir)
|
shutil.rmtree(tmpdir)
|
||||||
for f in files:
|
|
||||||
os.unlink(os.path.join(tmpdir, f))
|
|
||||||
os.rmdir(tmpdir)
|
|
||||||
|
|
||||||
|
|
||||||
def check_configs_tested(basedir, app_configs, ignore_configs):
|
def check_configs_tested(basedir, app_configs, ignore_configs):
|
||||||
|
|
Loading…
Reference in New Issue