Dne 14. 01. 19 v 18:36 Brian J. Murrell napsal(a): > Are the tags given to a --filter-by-tags argument available in the test > (i.e. setUp(), test_* functions, etc.)? > > The idea of course is so that a test can know which tags were requested > possibly for skipping, etc. > > Cheers, > b. >
Hello Brian,
they are not intended for dynamic usage. For dynamic purposes we have the test
params.
Anyway you asked whether they are available and in a way they are. It is not a
guaranteed interface, but it should probably work at least until we finish the
Job API (which should supersede all of these and is coming for years already).
Every test is also given the job instance and job instance contains full parsed
test arguments. So you can use something like:
self.job.args.filter_by_tags
in a test and get the list of tags set on the cmdline. Anyway you had been
warned that it is not a really good idea. Better would be to create an RFC (or
a mini-rfc) with some examples and possible interfaces we could discuss (or at
least to join any release meeting and discuss it live) so we can find a generic
solution. My first idea would be to populate "self.params" with filters to have
a single storage that would allow overrides/extensions from parameter system.
Regards,
Lukáš
PS: You can also use "sys.argv" but that is even nastier and also might go away
with the Job API (at least if we chose the way I envision :D).
signature.asc
Description: OpenPGP digital signature
