|
11 | 11 | _ignore_unknown = False
|
12 | 12 |
|
13 | 13 |
|
14 |
| -def _get_bool(value): |
15 |
| - """Evaluate string representation of a boolean value. |
16 |
| - """ |
17 |
| - if value: |
18 |
| - if value.lower() in ["0", "no", "n", "false", "f", "off"]: |
19 |
| - return False |
20 |
| - elif value.lower() in ["1", "yes", "y", "true", "t", "on"]: |
21 |
| - return True |
22 |
| - else: |
23 |
| - raise ValueError("Invalid truth value '%s'" % value) |
24 |
| - else: |
25 |
| - return False |
26 |
| - |
27 |
| - |
28 | 14 | class DependencyItemStatus(object):
|
29 | 15 | """Status of a test item in a dependency manager.
|
30 | 16 | """
|
@@ -142,15 +128,15 @@ def depends(request, other, scope='module'):
|
142 | 128 | def pytest_addoption(parser):
|
143 | 129 | parser.addini("automark_dependency",
|
144 | 130 | "Add the dependency marker to all tests automatically",
|
145 |
| - default=False) |
| 131 | + type="bool", default=False) |
146 | 132 | parser.addoption("--ignore-unknown-dependency",
|
147 | 133 | action="store_true", default=False,
|
148 | 134 | help="ignore dependencies whose outcome is not known")
|
149 | 135 |
|
150 | 136 |
|
151 | 137 | def pytest_configure(config):
|
152 | 138 | global _automark, _ignore_unknown
|
153 |
| - _automark = _get_bool(config.getini("automark_dependency")) |
| 139 | + _automark = config.getini("automark_dependency") |
154 | 140 | _ignore_unknown = config.getoption("--ignore-unknown-dependency")
|
155 | 141 | config.addinivalue_line("markers",
|
156 | 142 | "dependency(name=None, depends=[]): "
|
|
0 commit comments