[py-dev] steps to include a new plugin

Antonio Cuni anto.cuni at gmail.com
Mon Dec 3 20:58:14 CET 2012


Hi Holger,

On 11/27/2012 11:27 PM, holger krekel wrote:

>>      @pytest.marks('red', 'green', 'blue', 'black', 'orange', 'pink')
>>      def some_test_method(self):
>>          # some check-y stuff
> 
> I can see how each mark consuming a line can be cumbersome.  I wonder if
> there would be a way to have less line noise, however.  For example::
> 
>     @pytest.mark.red.green.blue.black.orange.pink
>     def test_method(...):
>         ...

I think that using the dot is a bad idea, because it conflicts with the
standard meaning that it has in Python, i.e. to "navigate" between layers/levels.

If we really want some syntactic sugar, the following is ugly but at least is
not as confusing as the one above:

m = pytest.mark
@m.red/m.green/m.blue
def test_method(...):
    ...

Even if I have to admit that in my explicit-is-better-than-implicit opinion,
the best ons is still the first.

ciao,
Anto



More information about the Pytest-dev mailing list