hundreds-father-404
04/02/2021, 5:22 PMhundreds-father-404
04/02/2021, 5:24 PMbash
vs. zsh
.
You control this by running your test file with a different shell, typically via shebang. You don't run shunit2 my_test.sh
, but rather add source ./shunit2
to my_test.sh
then run bash my_test.sh
or use the shebang
--
The problem is how Pants should approach this. Iiuc, we aren't supposed to simply set PATH and let the shebang do its thing? @fast-nail-55400 is that correct?
I don't think Pants trying to parse the shebang is a great idea
A field on a shell_tests
target sounds a bit clunky if it duplicates the shebang, but could work. It would have a cool benefit that you could do this:
shell_tests(shells=['bash', 'sh'])
Then Pants will run with all of those shells. That's actually pretty neat! Users could leave off the shebang, so no duplicationhundreds-father-404
04/02/2021, 5:25 PMshell_tests
is a misnomer and it should be shunit2_tests
. This target is pretty specific to the shunit2 frameworkhundreds-father-404
04/02/2021, 5:27 PMIt would have a cool benefit that you could do this. Then Pants will run with all of those shells.That could be cool to add to Shellcheck too, which also has a notion of which shell to run with, but has its own mechanisms already by parsing the shebang and falling back to a global option
enough-analyst-54434
04/02/2021, 5:44 PMenough-analyst-54434
04/02/2021, 5:45 PMmy/choice/shell unit_test.sh
hundreds-father-404
04/02/2021, 5:47 PMBut easiest is just my/choice/shell unit_test.shMy concern is how do we know what
my/choice/shell
should be?
1. Parse the shebang line
2. A field on the target
I'm thinking #2 because it allows the user to specify multiple shells. I'm looking at shunit2's own repo, and indeed they do that pattern of calling my/shell unit_test.sh
over the same file with each shell they care about. Pants can automate that. That's coolenough-analyst-54434
04/02/2021, 5:49 PMhundreds-father-404
04/02/2021, 5:50 PMenough-analyst-54434
04/02/2021, 6:16 PMfound/binary test.sh
seems like the base answer. Adding BUILD / config metadata to override or steer that for nonstandard cases seems secondary.happy-kitchen-89482
04/02/2021, 6:29 PMhappy-kitchen-89482
04/02/2021, 6:29 PMhundreds-father-404
04/02/2021, 6:33 PMcore/goals/test.py
to enable 1 TestFieldSet -> n results. Or, we approach it like we do with Python interpreter constraints that you create >1 target per file, with a distinct target per shell (gross)happy-kitchen-89482
04/02/2021, 6:37 PMhappy-kitchen-89482
04/02/2021, 6:37 PMhappy-kitchen-89482
04/02/2021, 6:37 PMhundreds-father-404
04/02/2021, 6:44 PMshunit2_tests
vs shell_tests
? I lean towards the former because this is so implementation-specific, e.g. the list of supported shells will be what shunit2 supports. The help message will have specific instructions about how the ingration works. etchappy-kitchen-89482
04/02/2021, 6:45 PMhappy-kitchen-89482
04/02/2021, 6:45 PMhappy-kitchen-89482
04/02/2021, 6:45 PMhundreds-father-404
04/02/2021, 6:46 PMhundreds-father-404
04/05/2021, 5:41 PMruntime_package_dependencies
with shunit2_tests as well? Have shell code to test that your Python distributions were built correctly? It's relatively trivial to implement
We can do in a followup or future feature alsohappy-kitchen-89482
04/05/2021, 5:46 PMhappy-kitchen-89482
04/05/2021, 5:46 PMcurved-television-6568
04/08/2021, 6:51 AMpython_tests
rather than pytest_tests
… 🙂hundreds-father-404
04/08/2021, 7:22 AM