Repository navigation
Commit 426e582
authored
After you suggestion in python/cpython#116504 (comment) I went to take a look at `test_cmd_line` in RustPython (it was so long ago I contributed to this amazing project, so may thing had changed!), and I've noticed this.
This is a problem, here' the simplest demo:
```python
import unittest
class TestMe(unittest.TestCase):
@unittest.expectedFailure
def test_me(self):
def run():
raise ValueError
with self.subTest(run=run):
run()
if __name__ == '__main__':
unittest.main()
```
This works as expected:
```
» ./python.exe ex.py
x
----------------------------------------------------------------------
Ran 1 test in 0.001s
OK (expected failures=1)
```
This does not:
```python
import unittest
class TestMe(unittest.TestCase):
def test_me(self):
@unittest.expectedFailure
def run():
raise ValueError
with self.subTest(run=run):
run()
if __name__ == '__main__':
unittest.main()
```
Produces:
```
» ./python.exe ex.py
E
======================================================================
ERROR: test_me (__main__.TestMe.test_me) (run=<function TestMe.test_me.<locals>.run at 0x1057a2150>)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/sobolev/Desktop/cpython2/ex.py", line 10, in test_me
run()
~~~^^
File "/Users/sobolev/Desktop/cpython2/ex.py", line 7, in run
raise ValueError
ValueError
----------------------------------------------------------------------
Ran 1 test in 0.001s
FAILED (errors=1)
```
So, I propose to remove these decorators, let's only keep `TODO` comments to indicate separate failures.
1 parent 92c8b37 commit 426e582
1 file changed
Lines changed: 0 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
281 | | - | |
282 | 281 | | |
283 | 282 | | |
284 | 283 | | |
285 | 284 | | |
286 | 285 | | |
287 | | - | |
288 | 286 | | |
289 | 287 | | |
290 | 288 | | |
| |||
293 | 291 | | |
294 | 292 | | |
295 | 293 | | |
296 | | - | |
297 | 294 | | |
298 | 295 | | |
299 | 296 | | |
| |||
0 commit comments