This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Naitree Zhu
Recipients Naitree Zhu
Date 2018-09-06.13:05:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1536239121.16.0.56676864532.issue34596@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-09-06 13:05:21Naitree Zhusetrecipients: + Naitree Zhu
2018-09-06 13:05:21Naitree Zhusetmessageid: <1536239121.16.0.56676864532.issue34596@psf.upfronthosting.co.za>
2018-09-06 13:05:21Naitree Zhulinkissue34596 messages
2018-09-06 13:05:20Naitree Zhucreate