From 6b6ffd02a7e88ea02c5138e33977f021040f6aa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Sun, 16 May 2021 08:25:24 +0200 Subject: [PATCH] fix python tests on powershell --- tests/bugfixes/github/test_issue_1472.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/bugfixes/github/test_issue_1472.py b/tests/bugfixes/github/test_issue_1472.py index 8ada3383..ebf7d08d 100644 --- a/tests/bugfixes/github/test_issue_1472.py +++ b/tests/bugfixes/github/test_issue_1472.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import os from system_tests import CaseMeta, CopyTmpFiles, path @CopyTmpFiles("$data_path/test_issue_1472.jpg") @@ -7,8 +8,12 @@ class test_issue_1472Test(metaclass=CaseMeta): filename = path("$tmp_path/test_issue_1472.jpg") exvfile = path("$tmp_path/test_issue_1472.exv") - commands = [ "rm -rf $exvfile" - , "$exiv2 -pa --grep LensType2 $filename" + + def setUp(self): + if os.path.isfile(self.exvfile): + os.remove(self.exvfile) + + commands = [ "$exiv2 -pa --grep LensType2 $filename" , "$exiv2 ex $filename" , "$exiv2 -pa --grep LensType2 $exvfile" , "$exiv2 rm $filename" @@ -16,8 +21,7 @@ class test_issue_1472Test(metaclass=CaseMeta): , "$exiv2 in $filename" , "$exiv2 -pa --grep LensType2 $filename" ] - stdout = ["" - ,"Exif.Sony2010e.LensType2 Short 1 1024\n" + stdout = ["Exif.Sony2010e.LensType2 Short 1 1024\n" ,"" ,"Exif.Sony2010e.LensType2 Short 1 1024\n" ,"" @@ -26,4 +30,4 @@ class test_issue_1472Test(metaclass=CaseMeta): ,"Exif.Sony2010e.LensType2 Short 1 1024\n" ] stderr = [""]*len(commands) - retval = [ 0,0,0,0,0,1,0,0] + retval = [ 0,0,0,0,1,0,0]