|
26 | 26 |
|
27 | 27 | # register argparse-style options and ini-file values, called once at the beginning of a test run |
28 | 28 | def pytest_addoption(parser: Parser) -> None: |
29 | | - group = parser.getgroup("collect") |
30 | | - group.addoption( |
| 29 | + parser.addoption( |
31 | 30 | "--inlinetest-only", |
32 | 31 | action="store_true", |
33 | 32 | default=False, |
34 | 33 | help="run inlinetests in all .py modules", |
35 | 34 | dest="inlinetest_only", |
36 | 35 | ) |
37 | | - group.addoption( |
| 36 | + parser.addoption( |
38 | 37 | "--inlinetest-glob", |
39 | 38 | action="append", |
40 | 39 | default=[], |
41 | 40 | metavar="pat", |
42 | 41 | help="inlinetests file matching pattern, default: *.py", |
43 | 42 | dest="inlinetest_glob", |
44 | 43 | ) |
45 | | - group.addoption( |
| 44 | + parser.addoption( |
46 | 45 | "--inlinetest-continue-on-failure", |
47 | 46 | action="store_true", |
48 | 47 | default=False, |
49 | 48 | help="for a given inlinetest, continue to run after the first failure", |
50 | 49 | dest="inlinetest_continue_on_failure", |
51 | 50 | ) |
52 | | - group.addoption( |
| 51 | + parser.addoption( |
53 | 52 | "--inlinetest-ignore-import-errors", |
54 | 53 | action="store_true", |
55 | 54 | default=False, |
56 | 55 | help="ignore inlinetest ImportErrors", |
57 | 56 | dest="inlinetest_ignore_import_errors", |
58 | 57 | ) |
59 | | - group.addoption( |
| 58 | + parser.addoption( |
60 | 59 | "--inlinetest-disable", |
61 | 60 | action="store_true", |
62 | 61 | default=False, |
63 | 62 | help="disable inlinetests", |
64 | 63 | dest="inlinetest_disable", |
65 | 64 | ) |
66 | | - group.addoption( |
| 65 | + parser.addoption( |
67 | 66 | "--inlinetest-group", |
68 | 67 | action="append", |
69 | 68 | default=[], |
70 | 69 | metavar="tag", |
71 | 70 | help="group inlinetests", |
72 | 71 | dest="inlinetest_group", |
73 | 72 | ) |
74 | | - group.addoption( |
| 73 | + parser.addoption( |
75 | 74 | "--inlinetest-order", |
76 | 75 | action="append", |
77 | 76 | default=[], |
@@ -1400,7 +1399,7 @@ def collect(self) -> Iterable[InlinetestItem]: |
1400 | 1399 | if self.config.getvalue("inlinetest_ignore_import_errors"): |
1401 | 1400 | pytest.skip("unable to import module %r" % self.path) |
1402 | 1401 | else: |
1403 | | - raise ImportError("unable to import module %r" % self.path) |
| 1402 | + raise |
1404 | 1403 |
|
1405 | 1404 | finder = InlineTestFinder() |
1406 | 1405 | runner = InlineTestRunner() |
|
0 commit comments