From 76092af1b29f4a4cf929637a8bbb2a6725e52e80 Mon Sep 17 00:00:00 2001 From: Max Hurlow Date: Mon, 16 Sep 2024 15:34:08 +0100 Subject: [PATCH] Add basic autotests setup --- README.md | 2 ++ app/evaluation_tests.py | 2 ++ app/requirements.txt | 1 + eval_tests.yaml | 9 +++++++++ 4 files changed, 14 insertions(+) create mode 100644 eval_tests.yaml diff --git a/README.md b/README.md index a8d3ebb..010aa78 100755 --- a/README.md +++ b/README.md @@ -59,6 +59,8 @@ config.json # Specify the name of the evaluation function in this file - Edit the `app/evaluation_tests.py` and `app/preview_tests.py` files to add tests which get run: - Every time you commit to this repo, before the image is built and deployed - Whenever the `healthcheck` command is supplied to the deployed function + - Edit the `eval_tests.yaml` file to add tests that get run on the evaluation function as above, + but are also added to the documentation as examples. - Edit the `app/docs.md` file to reflect your changes. This file is baked into the function's image, and is made available using the `docs` command. This feature is used to display this function's documentation on our [Documentation](https://lambda-feedback.github.io/Documentation/) website once it's been hooked up! --- diff --git a/app/evaluation_tests.py b/app/evaluation_tests.py index dfbc0ad..715cc9c 100755 --- a/app/evaluation_tests.py +++ b/app/evaluation_tests.py @@ -1,4 +1,5 @@ import unittest +from autotests import auto_test try: from .evaluation import Params, evaluation_function @@ -6,6 +7,7 @@ from evaluation import Params, evaluation_function +@auto_test("../eval_tests.yaml", evaluation_function) class TestEvaluationFunction(unittest.TestCase): """ TestCase Class used to test the algorithm. diff --git a/app/requirements.txt b/app/requirements.txt index e69de29..0216d40 100755 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -0,0 +1 @@ +autotests @ git+https://github.com/lambda-feedback/evaluation-function-auto-tests@main diff --git a/eval_tests.yaml b/eval_tests.yaml new file mode 100644 index 0000000..03d76ae --- /dev/null +++ b/eval_tests.yaml @@ -0,0 +1,9 @@ +# A placeholder test file. +# The tests described here are run on the evaluation function by Github Actions, +# and can be used to automatically generate examples for the documentation. +# You should populate this file with tests for your evaluation function. +# See https://github.com/lambda-feedback/evaluation-function-auto-tests for a +# detailed explanation of the test file format. +--- +title: placeholder +tests: []