taskwarrior icon indicating copy to clipboard operation
taskwarrior copied to clipboard

Renaming test files according to their language

Open felixschurk opened this issue 1 year ago • 5 comments

          > I agree that renaming the tests in that process is counter-intuitive. But, I'd also mildly prefer that these files were named `.py` in the source code, too -- several times I have opened `foo.t` in my editor only to realize it's a built binary. Although now that we use a build directory I suppose this isn't an issue.

Yes I agree, it is quite counter-intuitive renaming them only when moving them to the build folder. However I would also prefer to have the source files with the proper ending.. *.t.py for python tests, *.t.sh for bash tests and *.t.cpp for unit tests. One can handle that in a separate issue.

Originally posted by @felixschurk in https://github.com/GothenburgBitFactory/taskwarrior/issues/3387#issuecomment-2071344693

felixschurk avatar Apr 25 '24 05:04 felixschurk

What's the advantage of *.t.py vs *.py?

ryneeverett avatar Apr 25 '24 05:04 ryneeverett

I personally would say it make sense to have the tests follow some naming convention in order to really easily search them. Maybe even *.tests.py would make more sense.

This way one can search in the repository quite easily for corresponding tests and would not be confused with some maybe other Python files which are maybe only a helper script, such as basetest.py. I mean if I want to have all python tests it would then be find .... *.tests.py and one could be sure to have them, without any additional files.

I got the inspiration when working on other projects from this guide.

felixschurk avatar Apr 25 '24 05:04 felixschurk

Ah, fair enough. I forgot that the other tests already follow that convention. IMO the fact that they're in the test folder is sufficient but following the existing convention more consistently is better than what we have now.

ryneeverett avatar Apr 25 '24 05:04 ryneeverett

Hi Felix and Ryne. Just submitted PR #3407 that renames the test files. It uses the test.t.py and test.t.sh convention because, as Ryne pointed out, that's what's in place with the C++ tests now. I'd be happy to change it to *.tests.py or anything else though -- let me know when you can.

mattsmida avatar Apr 27 '24 02:04 mattsmida

I see now that there does need to be a pattern and I'm coming around to like the pattern in the style guide Felix linked: hello.test.cpp.

ryneeverett avatar Apr 27 '24 03:04 ryneeverett