[openstack-dev] [Hacking] unit test code is too less
Yuriy Taraday
yorik.sar at gmail.com
Thu Jan 23 07:45:03 UTC 2014
Hello.
On Thu, Jan 23, 2014 at 6:47 AM, ZhiQiang Fan <aji.zqfan at gmail.com> wrote:
>
> I noticed that in openstack-dev/hacking project, there is very little test
> code, is there any particular reason why it is in such situation?
>
Yes, there is. Every rule have a docstring that not only provides examples
of good and bad code but also is run as a doctest here:
https://github.com/openstack-dev/hacking/blob/master/hacking/tests/test_doctest.py
> https://github.com/openstack-dev/hacking/blob/master/hacking/core.py#L345
> it cannot detect
>
> \bprint$
> \bprint >>>xxx, (\s+
>
I'm not sure how can it not detect the second one since the regular
expression used there to detect bad strings is "\bprint\s+[^\(]" and it
catches "print >>>xxx, (" string.
The first one is a good catch though.
If I want to improve this rule, how can I verify that my change is good?
>
Just change that regular expression as is needed and add a line to the
docstring like these:
Okay: print()
H233: print
Happy coding!
--
Kind regards, Yuriy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140123/c5303b38/attachment.html>
More information about the OpenStack-dev
mailing list