|
4 | 4 |
|
5 | 5 | from PIL import Image |
6 | 6 |
|
7 | | -from nose import with_setup |
8 | | -from nose.tools import raises |
| 7 | +from nose2.tools.decorators import with_setup |
| 8 | +from nose2.tools.such import helper |
9 | 9 |
|
10 | 10 | import zxing |
11 | 11 |
|
@@ -119,27 +119,27 @@ def test_wrong_formats(): |
119 | 119 | for filename, expected_format, expected_raw in test_barcodes) |
120 | 120 |
|
121 | 121 |
|
122 | | -@raises(zxing.BarCodeReaderException) |
123 | 122 | def test_bad_java(): |
124 | 123 | test_reader = zxing.BarCodeReader(java=os.devnull) |
125 | | - test_reader.decode(test_barcodes[0][0]) |
| 124 | + with helper.assertRaises(zxing.BarCodeReaderException): |
| 125 | + test_reader.decode(test_barcodes[0][0]) |
126 | 126 |
|
127 | 127 |
|
128 | | -@raises(zxing.BarCodeReaderException) |
129 | 128 | def test_bad_classpath(): |
130 | 129 | test_reader = zxing.BarCodeReader(classpath=mkdtemp()) |
131 | | - test_reader.decode(test_barcodes[0][0]) |
| 130 | + with helper.assertRaises(zxing.BarCodeReaderException): |
| 131 | + test_reader.decode(test_barcodes[0][0]) |
132 | 132 |
|
133 | 133 |
|
134 | | -@raises(zxing.BarCodeReaderException) |
135 | 134 | @with_setup(setup_reader) |
136 | 135 | def test_nonexistent_file_error(): |
137 | 136 | global test_reader |
138 | | - test_reader.decode(os.path.join(test_barcode_dir, 'nonexistent.png')) |
| 137 | + with helper.assertRaises(zxing.BarCodeReaderException): |
| 138 | + test_reader.decode(os.path.join(test_barcode_dir, 'nonexistent.png')) |
139 | 139 |
|
140 | 140 |
|
141 | | -@raises(zxing.BarCodeReaderException) |
142 | 141 | @with_setup(setup_reader) |
143 | 142 | def test_bad_file_format_error(): |
144 | 143 | global test_reader |
145 | | - test_reader.decode(os.path.join(test_barcode_dir, 'bad_format.png')) |
| 144 | + with helper.assertRaises(zxing.BarCodeReaderException): |
| 145 | + test_reader.decode(os.path.join(test_barcode_dir, 'bad_format.png')) |
0 commit comments