[pytest-dev] pytest _pytest/mark.MarkMapping behavior

Yury Krasouski krasoffski at gmail.com
Mon Dec 4 12:29:05 EST 2017


Hi Ronny,

Many thanks for explanation!

Got this idea.

I am not sure that you are right person for this question. But could you do
a favor and suggest a prefirable way for extraction test marks?

At the current moment this looks like:
> mark_plugin = test_item.config.pluginmanager.getplugin('mark')
> if mark_plugin:
>     keywords = test_item.keywords
>     marks = mark_plugin.MarkMapping.from_keywords(keywords).own_mark_names
>     return [m for m in marks if m not in self.ignored_tags]

In other words I need a list of marks assigned with test item (test).

P.S. Or I need to duplicate logic in our plug-in from `from_keywords` class
method?

Thank you a lot,
Yury


2017-12-04 19:30 GMT+03:00 RonnyPfannschmidt <
opensource at ronnypfannschmidt.de>:

>
>
> Am 04.12.2017 um 16:23 schrieb Yury Krasouski:
>
> Hello Team,
>
> To begin with, I would like to say "Thank You" for great tools.
>
> I am writing here to ask question about _pytest/mark.MarkMapping behavior
> which was used in one plug-in. I noted that API is changed a little what
> produced issue like this:
> https://github.com/reportportal/agent-python-pytest/issues/37
>
> The fix is simple at first look: just replace _marks to own_mark_names.
> But I wonder about inconvenient behavior of
>
> > def __getitem__(self, name):
> >     return name in self.own_mark_names
>
> I would expect to call list(MarkMapping) which will return list of mark
> names, but instead this returns infinite iterator which produced False (or
> True in some cases). the im
>
> What is the reason for such behavior?
>
> the implementation of MarkMapping is only complete enough to fulfill its
> internal use case
> it has no correct iteration behavior implemented, thus the fallback of
> python breaks
>
> any use of this class outside of the code path it was hacked up for is
> likely completely incorrect
>
> -- Ronny
>
>
>
> Thanks,
> Yury
>
>
> _______________________________________________
> pytest-dev mailing listpytest-dev at python.orghttps://mail.python.org/mailman/listinfo/pytest-dev
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20171204/588bc8a0/attachment.html>


More information about the pytest-dev mailing list