gabbi icon indicating copy to clipboard operation
gabbi copied to clipboard

Q: What characters are legal / recommended for test name in YAML?

Open ghost opened this issue 9 years ago • 5 comments
trafficstars

I suspect plain alphanum + spaces is recommended, but I might sometimes want to do hyphen or parens. So, just being thorough.

Thanks!

ghost avatar Jun 09 '16 17:06 ghost

I was talking with someone about the first issue you raised and I thought: This would be a great time to start a FAQ. So keep em coming, these will all make fine faq starters.

In this particular case the honest answer is "dunno". I've not encountered a situation where I've tried to name a test and it hasn't worked, but that is probably because I'm biased in what I'm naming tests.

The full test name is the combination of what's in test_loader_name, the name of the yaml file and the the name attribute in each test (with spaces turned into underscores), and is, strictly speaking, a Python class.

To enable concurrent process grouping regex in .testr.conf (or other ways of doing it for other multi-process runners) to work out okay it is a good idea to not use _ in the name of the yaml file.

I've not proved out the limits of the test names. Probably something hypothesis would help with. Some casual testing in gabbi-run suggest that hyphen and parens are okay.

Do you think there should be defined restrictions? My attitude so far is that if you do something wrong, as long as it tells you very early in the process and with a reasonable error message, then it's okay.

cdent avatar Jun 09 '16 18:06 cdent

I'm good with there not being defined restrictions. I think a FAQ would be great. You could use the Github Wiki for that perhaps. Thanks for looking into this!

p.s. rather than opening another issue immediately, another quick question: Is it possible to source integers from environment variables in the YAML? I ask because I just tried to source poll delay and count from environ, but test failed complaining about strings vs. integers. I tried unquoting the value during shell export, but no dice. Worth opening a new issue?

josdotso avatar Jun 09 '16 18:06 josdotso

made #145 to keep a reminder active for making a FAQ

The issue with strings and ints is because environment variables are always strings, see this block of code. In that block it would be possible to turn things that look like ints into its.

However, poll and count, don't use substitutions so even if the environment was producing stuff it wouldn't get pulled, so some fixes would be needed in the poll handling.

Yeah, if you could make a fresh issue, that would be great.

cdent avatar Jun 09 '16 18:06 cdent

This jiggery pokery in #152 to make sure that the pytest filtering doesn't interfere with non gabbi tests loaded in the same session makes an assumption that the yaml files do not contain underscores so might be wise to codify that and warn when the filenames don't match.

cdent avatar Jun 10 '16 23:06 cdent

re-opening this to make it clear that this question should be added to the faq being started in #163

cdent avatar Aug 16 '16 15:08 cdent