From 4af705c15d9a3e0afee4ccf113a9deecbbe46157 Mon Sep 17 00:00:00 2001 From: Leonardo Grasso Date: Mon, 12 Oct 2020 19:09:15 +0200 Subject: [PATCH] fix(test): correct parent dir creation for strict tests Signed-off-by: Leonardo Grasso --- test/falco_test.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/test/falco_test.py b/test/falco_test.py index a9d4d44e..f1fd1e2d 100644 --- a/test/falco_test.py +++ b/test/falco_test.py @@ -224,13 +224,14 @@ class FalcoTest(Test): output['actual'] = key output['expected'] = value output_strictly_contains.append(output) - # Clean up file from previous tests, if any - if not output['actual'] == 'stdout' and os.path.exists(output['actual']): - os.remove(output['actual']) - filedir = os.path.dirname(output['expected']) - # Create the parent directory for the file if it doesn't exist. - if not os.path.isdir(filedir): - os.makedirs(filedir) + if not output['actual'] == 'stdout': + # Clean up file from previous tests, if any + if os.path.exists(output['actual']): + os.remove(output['actual']) + # Create the parent directory for the file if it doesn't exist. + filedir = os.path.dirname(output['actual']) + if not os.path.isdir(filedir): + os.makedirs(filedir) self.output_strictly_contains = output_strictly_contains self.grpcurl_res = None