Skip to content

Create friendly way for users to test their code #1

Description

@PinkShnack

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:

  1. 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.
  2. 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.

Activity

  1. PinkShnack commented on Nov 15, 2021

    @PinkShnack
    ContributorAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions