Hi Holger I would like to work on this but I've some very silly doubts which I would like to clarify. Please bear with me if I'm unclear/repeating in my views as this is my first time contributing to any open source project experience.
I tried understanding this problem and looking inside source code. With help from nice people on IRC, I could understand how it is implemented (namely matchmark & matchkeyword method in mark.py module). My issue is: 1. I don't understand how we can put dotted path as marker. Currently if I try a marker (like @pytest.mark.a.b), I get error "AttributeError: MarkDecorator instance has no attribute 'b'". Does this feature require a fix of this so that we can allow custom markers with dots. 2. Similarly for 'keywords', in what scenario dotted path (like 4.3) will be a keyword? We can't put it as method_name, class_name etc. Only option left is parametrized testcases but I grasp this. Please guide me to docs/links regarding this. Thanks & Regards Alok On Wed, Oct 22, 2014 at 12:51 PM, holger krekel <[email protected]> wrote: > Hi all, > > is anyone interested in a little exercise that would improve pytest usage? > It doesn't require deep pytest knowledge. > > This is about the "-k" and "-m" selection mini-language, > namely expressions like: > > marker1 and marker2 > not marker1 and (marker2 or marker3) > > and so forth. The thing is that pytest currently uses Python's "eval" with > a custom dictionary which means that names such as "marker1" > cannot have dots or other punctuation and also other things are not > possible like running all tests that don't have "4.3" (coming from a > parametrized test) in it: > > -k 'not 4.3' > > This would currently select all tests because "4.3" is true. Various > people have run into traps like this. > > So what is needed here are tests and code that, given a set of names > and an expression string, determines if the expression is true or not. > And everything except "and" and "or" are valid words. To use the latter > two words probably need to have some escaping like "\and" or so but > that's a bonus task :) > > Anyone up for this little exercise? Or other comments? > > best and thanks, > holger > > > _______________________________________________ > Pytest-dev mailing list > [email protected] > https://mail.python.org/mailman/listinfo/pytest-dev >
_______________________________________________ pytest-dev mailing list [email protected] https://mail.python.org/mailman/listinfo/pytest-dev
