-
Notifications
You must be signed in to change notification settings - Fork 17
Support tags #314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support tags #314
Conversation
Nice feature, thanks! My comments:
P.S. For playing with the feature I have marked Tarantool tests (except suites sql, sql-tap, box, replication and vinyl) and pushed to a branch https://github.com/tarantool/tarantool/tree/ligurio/tagging-tests |
Thanks for the feedback! My next actions in short:
I plan to do so at beginning of the next week. Full answers are below.
Sure. I placed TODO comments into the source, which describe exactly same idea. It is a bit more complex than current patch (we should support multiline comments, map an executable name in the build dir into a test name in the source dir). So I decided to postpone it until we'll see a need.
Good catch. I'll do.
Not necessarily: we can do it on demand. My motivation behind implementing the feature was to move gh-xxxx marks from test names to metainformation and keep ability to run all tests related to a particular issue. IOW, for me it is activity of the kind 'provide the feature and see whether developers will use it'.
I like this idea. Just
If someone want to look across all test and do some code health activity, it is easy to collect all such tests using
I trying to modify test-run in the backward compatible way for a long time. Sometimes it helps to update from some ancient test-run version (we recently updated test-run in vshard, where it was not updated two years). I would keep test-run side support and possibly move to tags in tarantool itself.
Thanks! I see that many tags that correspond to a test suite name were added. I had some thoughts about this. If we'll accept it as a rule, it would be a bit annoying to do it consistently and don't forget about this. So, my first idea was to include a test suite name into implicit tags. But we have, say, sql and sql-tap suites and both are about sql. So next idea was to add a What do you think? |
Personally, I don't like implicit things. It makes everything more complex. Now you want to introduce a more flexible tagging mechanism, and tests may have different tags without limitations. You can even come up with a new own tag and add it to a test! I think it is not a good idea to mix both mechanisms for tagging tests. With file- or testcase-based tagging directory-tagging become useless and we can keep all our tests in a single directory or split them by types and keep only three dirs: unit, tap and interactive. |
2d04969
to
e030ba2
Compare
Sorry, I have no time to write tests here (that's free time activity), so I only tested it manually. |
@ligurio When we look on the question at this angle, it looks meaningful. Okay. But I would not make it a kind of policy at least until we'll have some validation scripts around (like warning if a test in the 'vinyl' directory has no 'vinyl' tag). |
Usage: ```sh ./test-run.py --tags foo ./test-run.py --tags foo,bar app/ app-tap/ ``` test-run will run only those tests, which have at least one of the provided tags. The tags metainfo should be placed within a first comment of a test file (see examples in the README.md file). Unsupported features: * Marking unit tests with tags. * Multiline comments (use singleline ones for now). Fixes #22
Usage: ```sh ./test-run.py --tags ./test-run.py app-tap/ --tags ``` Follows up #22
e030ba2
to
5dc30ae
Compare
line = line.rstrip('\n') | ||
if line.startswith('#!'): | ||
pass | ||
elif line == '': | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is not the possible situation when a line starts with several spaces?
Maybe for clearness use line = line.strip()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, it would like the following:
#!/usr/bin/env tarantool
-- tags: lalala
--
-- Blah blah.
Or:
#!/usr/bin/env tarantool
-- Blah blah.
--
-- tags: lalala
It would be quite strange to indent a top level comment this way. Since we accept only first comment (precisely: first non-empty block except maybe shebang, when it is a comment), it must be at the top level.
Another possibility is the 'empty' line that contains only whitespaces. Trailing whitespaces are highly discouraged in programming, even git diff
colors them as red.
So, back to your question: yep, it is technically possible, but has no sense.
""" Extract tags from a first comment in the file. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This remark is not associated with your pull request, but with all docstrings through the project. In spite of citing PEP257 our docstrings have no identical format. I think we have to change this and fix the format for one-line and multi-line docstrings in our code style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer the way shown here, because of several reasons:
- The text is indented by four spaces.
- Short single line descriptions and long multiline ones look uniformly.
- Ending a single line comment with a whitespace (to make it centric) seems a bit unnatural for me (
""" Foo. """
).
I'm trying to stick with this style.
I don't know, to be honest, what is the best, but I would not really bother much. Only if it is 10% of your average bi-weekly work around the project (IOW, when you work on it almost all time). Otherwise it is too costly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't mean to refactor the code. I mean fix one type of code syle in our developer guide.
Could you add at least a one simple integration test for feature? |
If I'll find some spare time for that. I have some ideas how to better structurize such tests, but I'm not ready to spent 1-2 day on experiments ATM. At least, I'll review your pending PRs first :) |
I think it is time to deliver it and show what will occur :) |
Now it is possible to mark test files with tags and run some group of tests using the `--tags` option. Usage: | ./test-run.py --tags foo | ./test-run.py --tags foo,bar app/ app-tap/ Show the list of tags: | ./test-run.py --tags | ./test-run.py app-tap/ --tags See syntax and more details in tarantool/test-run#314 See the task description and possible usages in tarantool/test-run#22
Now it is possible to mark test files with tags and run some group of tests using the `--tags` option. Usage: | ./test-run.py --tags foo | ./test-run.py --tags foo,bar app/ app-tap/ Show the list of tags: | ./test-run.py --tags | ./test-run.py app-tap/ --tags See syntax and more details in tarantool/test-run#314 See the task description and possible usages in tarantool/test-run#22 (cherry picked from commit 9ac85ac)
Now it is possible to mark test files with tags and run some group of tests using the `--tags` option. Usage: | ./test-run.py --tags foo | ./test-run.py --tags foo,bar app/ app-tap/ Show the list of tags: | ./test-run.py --tags | ./test-run.py app-tap/ --tags See syntax and more details in tarantool/test-run#314 See the task description and possible usages in tarantool/test-run#22 (cherry picked from commit 9ac85ac)
Updated the test-run submodule in tarantool in 2.10.0-beta1-88-g9ac85ace9, 2.8.2-23-gac4097796, 1.10.11-11-g0d904b7a5. |
Usage:
test-run will run only those tests, which have at least one of the
provided tags.
Show a list of tags:
The tags metainfo should be placed within a first comment of a test
file.
Examples:
.lua file:
.sql file:
.py file:
Unsupported features:
Fixes #22