|
67 | 67 | FAIL, |
68 | 68 | b'Fie\nFoe\nfee\nfum\n', |
69 | 69 | ), |
| 70 | + ), |
| 71 | +) |
| 72 | +def test_integration(input_s, argv, expected_retval, output, tmpdir): |
| 73 | + path = tmpdir.join('file.txt') |
| 74 | + path.write_binary(input_s) |
| 75 | + |
| 76 | + output_retval = main([str(path)] + argv) |
| 77 | + |
| 78 | + assert path.read_binary() == output |
| 79 | + assert output_retval == expected_retval |
| 80 | + |
| 81 | + |
| 82 | +@pytest.mark.parametrize( |
| 83 | + ('input_s', 'argv'), |
| 84 | + ( |
70 | 85 | ( |
71 | 86 | b'fee\nFie\nFoe\nfum\n', |
72 | 87 | ['--unique', '--ignore-case'], |
73 | | - PASS, |
74 | | - b'fee\nFie\nFoe\nfum\n', |
75 | 88 | ), |
76 | 89 | ( |
77 | 90 | b'fee\nfee\nFie\nFoe\nfum\n', |
78 | 91 | ['--unique', '--ignore-case'], |
79 | | - FAIL, |
80 | | - b'fee\nFie\nFoe\nfum\n', |
81 | 92 | ), |
82 | 93 | ), |
83 | 94 | ) |
84 | | -def test_integration(input_s, argv, expected_retval, output, tmpdir): |
| 95 | +def test_integration_invalid_args(input_s, argv, tmpdir): |
85 | 96 | path = tmpdir.join('file.txt') |
86 | 97 | path.write_binary(input_s) |
87 | 98 |
|
88 | | - output_retval = main([str(path)] + argv) |
89 | | - |
90 | | - assert path.read_binary() == output |
91 | | - assert output_retval == expected_retval |
| 99 | + with pytest.raises(SystemExit): |
| 100 | + main([str(path)] + argv) |
0 commit comments