From 272d2615058d63e8bfa593385cc7d9f0c85684cd Mon Sep 17 00:00:00 2001 From: Andrei-Adnan Ismail Date: Wed, 7 Oct 2015 15:31:55 +0300 Subject: [PATCH] #405 Making sure that /tmp/proxysql-tests actually exists before trying to delete it .. and also logging the delete error better --- test/proxysql_base_test.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/proxysql_base_test.py b/test/proxysql_base_test.py index 1a73e6d31..30b11fe58 100644 --- a/test/proxysql_base_test.py +++ b/test/proxysql_base_test.py @@ -1,4 +1,5 @@ import os +import os.path import random import re import shutil @@ -177,6 +178,10 @@ class ProxySQLBaseTest(TestCase): cursor.close() proxy_admin_connection.close() + @classmethod + def onerror(cls, function, path, excinfo): + print("Error while trying to delete %s: %r" % (path, excinfo)) + @classmethod def setUpClass(cls): # Always shutdown docker services because the previous test might have @@ -185,6 +190,7 @@ class ProxySQLBaseTest(TestCase): try: shutil.rmtree('/tmp/proxysql-tests/', onerror=cls.onerror) + if os.path.exists('/tmp/proxysql-tests'): except: pass