You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Create friendly way for users to test their code #1
When users add a script, it should work within a virtual environment with the requirements given by the user.
This means each folder will have a .py python script and a requirements.txt file.
We have two options:
We can have the user create a test file and test via pytest.
Pros: The testing with pytest is easy.
Cons: The first part may be difficult for the user.
We can create a bash script that runs the new script with source run_script [path] from the terminal. This has been implemented in the tests folder and in github actions.
Pros: This means the user does not need to provide anything other than the .py and .txt files. For me this is very important.
Cons: It is more complicated to implement and because it is a bash script, it doesn't stop if there is a Python error. Could capture and parse the stdout and display a "Fail" message at the end of the script.
After not working on this for a while, I think that just having scripts run without errors is enough for them to be tested.
However, shared functions should be tested with a test_*py file. Bst to have this in the same directory as the functions, as the requirements file is already there, and so can be called during the same workflow or in a separate one.
This could be done by just parsing the filenames and feeding those with test in the name to pytest and those without test just run with python as done right now.
Activity
PinkShnack commentedon Nov 15, 2021
After not working on this for a while, I think that just having scripts run without errors is enough for them to be tested.
However, shared functions should be tested with a
test_*pyfile. Bst to have this in the same directory as the functions, as the requirements file is already there, and so can be called during the same workflow or in a separate one.This could be done by just parsing the filenames and feeding those with
testin the name to pytest and those withouttestjust run with python as done right now.