[pytest-dev] Proposal: python namespacign for markings/marker objects

Ronny Pfannschmidt opensource at ronnypfannschmidt.de
Thu Oct 20 10:33:26 EDT 2016

On 20.10.2016 15:14, Bruno Oliveira wrote:
> Hey Ronny,
> On Thu, Oct 20, 2016 at 10:55 AM Ronny Pfannschmidt
> <opensource at ronnypfannschmidt.de
> <mailto:opensource at ronnypfannschmidt.de>> wrote:
>>     b) Another suggestion from Ronny: running collection and getting
>>     used marker names. I'm not entirely sure what this means exactly,
>>     since the original proposal doesn't use "names" at all, only the
>>     objects directly.
>     in my proposal the "name" of a marker would be either the current
>     string or a type
> I'm still not getting how that fits with the collection of *tests*...
> consider this module:
> # contents of test_foo.py
> from pytest_blocker import Blocker
> @Blocker(123)
> def test_foo():
>     pass
fist that usage is wrong, a *mark* object in my proposal is neither
usable as decorator,
 nor aware of mark mechanism, it can literally be any object

a *mark* is orthogonal to the process of marking, mixing those 2
concepts just creates a huge mess

after collection you have the test items, those have all the markers,
from the markers of test items one can infer the markers used in the
collected tests
-- Ronny
> How does pytest know that the file "test_foo" uses "Blocker", and that
> "Blocker" is a marker? One possible solution would be to inspect the
> namespace and see if any of the objects are a pytest.Mark subclass.
> I'm not suggesting that, just trying to illustrate what I mean by my
> question.
>     another important part of my proposal is, that i want to decouple
>     from the namespace we put into pytest.mark,
>     after all there is now a multitude of plugins that register
>     certain markers, sometimes for *different* usages and incompatible
>     signatures
> That's the "flat namespaces" part of the discussion, if I'm
> understanding your proposal correctly. :)
>>     IMHO the discussion by email at this point is a little hard to
>>     digest and to track all points/replies/proposals. Perhaps we
>>     should move this discussion to a different venue? I propose an
>>     issue on GitHub because the main issue containing the proposal
>>     can be updated as the discussion progresses, although I'm not
>>     sure if it would be any easier to track the discussion itself.
>>     Perhaps using the Wiki would also be possible?
>     i could make a wiki page
> I would like to see what others think first. People might be OK with
> the current format, or have other suggestions.
> Cheers
> Bruno.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20161020/7f80b405/attachment.html>

More information about the pytest-dev mailing list