(self)
| 231 | self.checkError([opt, '-f', 'foo'], "don't go together") |
| 232 | |
| 233 | def test_match(self): |
| 234 | for opt in '-m', '--match': |
| 235 | with self.subTest(opt=opt): |
| 236 | ns = self.parse_args([opt, 'pattern']) |
| 237 | self.assertEqual(ns.match_tests, [('pattern', True)]) |
| 238 | self.checkError([opt], 'expected one argument') |
| 239 | |
| 240 | for opt in '-i', '--ignore': |
| 241 | with self.subTest(opt=opt): |
| 242 | ns = self.parse_args([opt, 'pattern']) |
| 243 | self.assertEqual(ns.match_tests, [('pattern', False)]) |
| 244 | self.checkError([opt], 'expected one argument') |
| 245 | |
| 246 | ns = self.parse_args(['-m', 'pattern1', '-m', 'pattern2']) |
| 247 | self.assertEqual(ns.match_tests, [('pattern1', True), ('pattern2', True)]) |
| 248 | |
| 249 | ns = self.parse_args(['-m', 'pattern1', '-i', 'pattern2']) |
| 250 | self.assertEqual(ns.match_tests, [('pattern1', True), ('pattern2', False)]) |
| 251 | |
| 252 | ns = self.parse_args(['-i', 'pattern1', '-m', 'pattern2']) |
| 253 | self.assertEqual(ns.match_tests, [('pattern1', False), ('pattern2', True)]) |
| 254 | |
| 255 | self.addCleanup(os_helper.unlink, os_helper.TESTFN) |
| 256 | with open(os_helper.TESTFN, "w") as fp: |
| 257 | print('matchfile1', file=fp) |
| 258 | print('matchfile2', file=fp) |
| 259 | |
| 260 | filename = os.path.abspath(os_helper.TESTFN) |
| 261 | ns = self.parse_args(['-m', 'match', '--matchfile', filename]) |
| 262 | self.assertEqual(ns.match_tests, |
| 263 | [('match', True), ('matchfile1', True), ('matchfile2', True)]) |
| 264 | |
| 265 | ns = self.parse_args(['-i', 'match', '--ignorefile', filename]) |
| 266 | self.assertEqual(ns.match_tests, |
| 267 | [('match', False), ('matchfile1', False), ('matchfile2', False)]) |
| 268 | |
| 269 | def test_failfast(self): |
| 270 | for opt in '-G', '--failfast': |
nothing calls this directly
no test coverage detected