dev: fix justfile integration-test recipe#4249
Conversation
integration-test recipe used build-integration-test as a dependency, but after dependency is executed (or if it doesn't run) the integration-test recipe failed because it didn't source the environment by itself: ``` $ just integration-test ... invoke tests sh: 1: invoke: not found error: Recipe `integration-test` failed on line 189 with exit code 127 ``` This commit duplicates the shebang from build-integration-test to integration-test so that the recipe works again. I'm not sure if there's a way to avoid the copy paste though, if there is, hopefully somebody mentions it in the review. Signed-off-by: Marcel Guzik <marcel.guzik@cumulocity.com>
Robot Results
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
| cd tests/RobotFramework | ||
| source .venv/bin/activate | ||
| invoke tests {{ARGS}} |
There was a problem hiding this comment.
I realise this PR absolutely doesn't introduce this pattern, but I find it puzzling that we're writing the recipe in bash mode and then bringing the entire venv into the path when we could just execute the relevant process directly from the venv. For example, this AFAIK should work, and would be directly compatible with just, no bash required (though the other change here does need that):
| cd tests/RobotFramework | |
| source .venv/bin/activate | |
| invoke tests {{ARGS}} | |
| cd tests/RobotFramework && .venv/bin/invoke tests {{ARGS}} |
Update I was slightly mistaken in my assumption that this would work - pabot executes robot as a bare command (which feels like a risky approach to spawning robot), so we'd need to modify the PATH to include the venv, something like the following at the end of tasks.py to make it work:
c.run(
" ".join(command),
env={
"PATH": f"{Path(sys.executable).parent}:{os.environ.get('PATH', '')}",
},
)There was a problem hiding this comment.
tbh I'd like to avoid modifying tasks.py and introducing this special handling for $PATH just for the sake of a single recipe
Proposed changes
integration-test recipe used build-integration-test as a dependency, but after dependency is executed (or if it doesn't run) the integration-test recipe failed because it didn't source the environment by itself:
This commit duplicates the shebang from build-integration-test to integration-test so that the recipe works again. I'm not sure if there's a way to avoid the copy paste though, if there is, hopefully somebody mentions it in the review.
Types of changes
Paste Link to the issue
Checklist
just prepare-devonce)just formatas mentioned in CODING_GUIDELINESjust checkas mentioned in CODING_GUIDELINESFurther comments