From 23e29e9527ed18e8946cdffe7a830e08d3030b1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Mon, 28 May 2018 00:38:57 +0200 Subject: [PATCH] [testsuite] Use system_tests.path() in some test cases --- tests/bugfixes/github/test_issue_283.py | 13 ++++++------- tests/bugfixes/github/test_pr_317.py | 10 +++++----- tests/bugfixes/redmine/test_issue_751.py | 13 ++++++------- tests/bugfixes/redmine/test_issue_799.py | 13 ++++++------- 4 files changed, 23 insertions(+), 26 deletions(-) diff --git a/tests/bugfixes/github/test_issue_283.py b/tests/bugfixes/github/test_issue_283.py index fc9df793..b5bd8e1b 100644 --- a/tests/bugfixes/github/test_issue_283.py +++ b/tests/bugfixes/github/test_issue_283.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -import system_tests -import os.path +from system_tests import CaseMeta, path, check_no_ASAN_UBSAN_errors -class TestFirstPoC(metaclass=system_tests.CaseMeta): + +class TestFirstPoC(metaclass=CaseMeta): """ Regression test for the bug described in: https://github.com/Exiv2/exiv2/issues/283 @@ -16,16 +16,15 @@ class TestFirstPoC(metaclass=system_tests.CaseMeta): Here we want to also check that the two last lines of got_stderr have the expected_stderr """ - system_tests.check_no_ASAN_UBSAN_errors(self, i, command, got_stderr, expected_stderr) + check_no_ASAN_UBSAN_errors(self, i, command, got_stderr, expected_stderr) self.assertListEqual(expected_stderr.splitlines(), got_stderr.splitlines()[-2:]) - filename = os.path.join("$data_path", "pocIssue283.jpg") + filename = path("$data_path/pocIssue283.jpg") commands = ["$exiv2 $filename"] stdout = [""] stderr = [ - """$exiv2_exception_message """ + filename + """: + """$exiv2_exception_message $filename: $kerCorruptedMetadata """] compare_stderr = check_no_ASAN_UBSAN_errors retval = [1] - diff --git a/tests/bugfixes/github/test_pr_317.py b/tests/bugfixes/github/test_pr_317.py index 53265342..bdc6855a 100644 --- a/tests/bugfixes/github/test_pr_317.py +++ b/tests/bugfixes/github/test_pr_317.py @@ -1,17 +1,17 @@ # -*- coding: utf-8 -*- -import system_tests +from system_tests import CaseMeta, path -class CanonEOSM100(metaclass=system_tests.CaseMeta): +class CanonEOSM100(metaclass=CaseMeta): - filename = "$data_path/exiv2-pr317.exv" + filename = path("$data_path/exiv2-pr317.exv") commands = ["$exiv2 -pa --grep model/i $filename"] stdout = ["""Exif.Image.Model Ascii 15 Canon EOS M100 Exif.Canon.ModelID Long 1 EOS M100 Exif.Photo.LensModel Ascii 29 EF-M15-45mm f/3.5-6.3 IS STM """ - ] + ] stderr = [""] - retval = [0] + retval = [0] diff --git a/tests/bugfixes/redmine/test_issue_751.py b/tests/bugfixes/redmine/test_issue_751.py index 3170112c..aeece572 100644 --- a/tests/bugfixes/redmine/test_issue_751.py +++ b/tests/bugfixes/redmine/test_issue_751.py @@ -1,17 +1,16 @@ # -*- coding: utf-8 -*- -import system_tests -import os.path +from system_tests import DeleteFiles, CopyFiles, CaseMeta, path -@system_tests.DeleteFiles("$xmpname") -@system_tests.CopyFiles("$data_path/exiv2-empty.jpg") -class AdobeXmpNamespace(metaclass=system_tests.CaseMeta): +@DeleteFiles("$xmpname") +@CopyFiles("$data_path/exiv2-empty.jpg") +class AdobeXmpNamespace(metaclass=CaseMeta): url = "http://dev.exiv2.org/issues/751" - filename = os.path.join("$data_path", "exiv2-empty_copy.jpg") - xmpname = os.path.join("$data_path", "exiv2-empty_copy.xmp") + filename = path("$data_path/exiv2-empty_copy.jpg") + xmpname = path("$data_path/exiv2-empty_copy.xmp") commands = [ """$exiv2 -v -M"reg imageapp orig/" -M "set Xmp.imageapp.uuid abcd" $filename""", diff --git a/tests/bugfixes/redmine/test_issue_799.py b/tests/bugfixes/redmine/test_issue_799.py index 573421e3..fcf5b92b 100644 --- a/tests/bugfixes/redmine/test_issue_799.py +++ b/tests/bugfixes/redmine/test_issue_799.py @@ -1,19 +1,18 @@ # -*- coding: utf-8 -*- -import system_tests -import os +from system_tests import DeleteFiles, CopyFiles, CaseMeta, path -@system_tests.DeleteFiles("$xmpfile") -@system_tests.CopyFiles("$data_path/exiv2-empty.jpg") -class WrongXmpTypeForNestedXmpKeys(metaclass=system_tests.CaseMeta): +@DeleteFiles("$xmpfile") +@CopyFiles("$data_path/exiv2-empty.jpg") +class WrongXmpTypeForNestedXmpKeys(metaclass=CaseMeta): url = "http://dev.exiv2.org/issues/$num" num = 799 - cmdfile = os.path.join("$data_path", "bug$num.cmd") + cmdfile = path("$data_path/bug$num.cmd") - filename_common = os.path.join("$data_path", "exiv2-empty_copy") + filename_common = path("$data_path/exiv2-empty_copy") filename = "$filename_common.jpg" xmpfile = "$filename_common.xmp"