Message324688
When using @skip decorator, `reason` argument is required. But one could easily overlook that and use it like so:
class SomeTest(TestCase):
@skip
def test_method(self):
# ...
The test actually passes when running with unittest, because it's equivalent to
class SomeTest(TestCase):
def test_method(self):
# ...
test_method = skip(test_method)
This gives the illusion that @skip decorator worked as expected.
I propose we should check the passed in `reason`, and raise error if it looks like a function/method, therefore prevent this erroneous usage.
In practice, this behavior has misled people using the decorator in the unintended way. For example: In this chapter of Test-Driven Development with Python (http://www.obeythetestinggoat.com/book/chapter_organising_test_files.html), the author used @skip decorator without `reason` argument. |
|
Date |
User |
Action |
Args |
2018-09-06 13:05:21 | Naitree Zhu | set | recipients:
+ Naitree Zhu |
2018-09-06 13:05:21 | Naitree Zhu | set | messageid: <1536239121.16.0.56676864532.issue34596@psf.upfronthosting.co.za> |
2018-09-06 13:05:21 | Naitree Zhu | link | issue34596 messages |
2018-09-06 13:05:20 | Naitree Zhu | create | |
|