|
6 | 6 |
|
7 | 7 | from nose2.tools.decorators import with_setup |
8 | 8 | from nose2.tools.such import helper |
| 9 | +import unittest |
9 | 10 |
|
10 | 11 | import zxing |
11 | 12 |
|
@@ -48,6 +49,10 @@ def test_version(): |
48 | 49 | @with_setup(setup_reader) |
49 | 50 | def _check_decoding(filename, expected_format, expected_raw, extra={}, as_Image=False): |
50 | 51 | global test_reader |
| 52 | + if test_reader.zxing_version_info >= (3, 5, 0) and expected_format == 'PDF_417': |
| 53 | + # See https://github.com/zxing/zxing/issues/1682 and https://github.com/zxing/zxing/issues/1683 |
| 54 | + raise unittest.SkipTest("ZXing v{} CommandLineRunner is broken for combination of {} barcode format and --raw option".format( |
| 55 | + test_reader.zxing_version, expected_format)) |
51 | 56 | path = os.path.join(test_barcode_dir, filename) |
52 | 57 | what = Image.open(path) if as_Image else path |
53 | 58 | logging.debug('Trying to parse {}, expecting {!r}.'.format(path, expected_raw)) |
@@ -83,8 +88,10 @@ def test_possible_formats(): |
83 | 88 | @with_setup(setup_reader) |
84 | 89 | def test_decoding_multiple(): |
85 | 90 | global test_reader |
86 | | - filenames = [os.path.join(test_barcode_dir, filename) for filename, expected_format, expected_raw in test_valid_images] |
87 | | - for dec, (filename, expected_format, expected_raw) in zip(test_reader.decode(filenames, pure_barcode=True), test_valid_images): |
| 91 | + # See https://github.com/zxing/zxing/issues/1682 and https://github.com/zxing/zxing/issues/1683 |
| 92 | + _tvi = [x for x in test_valid_images if test_reader.zxing_version_info < (3, 5, 0) or x[1] != 'PDF_417'] |
| 93 | + filenames = [os.path.join(test_barcode_dir, filename) for filename, expected_format, expected_raw in _tvi] |
| 94 | + for dec, (filename, expected_format, expected_raw) in zip(test_reader.decode(filenames, pure_barcode=True), _tvi): |
88 | 95 | assert dec.raw == expected_raw, ( |
89 | 96 | '{}: Expected {!r} but got {!r}'.format(filename, expected_raw, dec.parsed)) |
90 | 97 | assert dec.format == expected_format, ( |
|
0 commit comments