From 00e824a44686cec197b3ff1f824d8f6c8fa86637 Mon Sep 17 00:00:00 2001 From: "Lorenzo (Mec-iS)" Date: Tue, 11 Feb 2020 14:57:04 +0000 Subject: [PATCH] Add scripts --- README.md | 21 ++++++++------------- install.sh | 5 +++++ run.sh => run_dev_server.sh | 2 +- run_integration_tests.sh | 1 + run_unit_tests.sh | 1 + 5 files changed, 16 insertions(+), 14 deletions(-) create mode 100755 install.sh rename run.sh => run_dev_server.sh (94%) mode change 100644 => 100755 create mode 100755 run_integration_tests.sh create mode 100755 run_unit_tests.sh diff --git a/README.md b/README.md index 1e48f4e..781afe0 100644 --- a/README.md +++ b/README.md @@ -50,29 +50,24 @@ C. a POSIX file system: the codebase uses Async File I/O on a regular filesystem * add `docker-compose` with multi-volume support -## Build -Full build procedure: -```` -$ python3.7 -m venv venv -$ source venv/bin/activate -$ pip install setuptools --upgrade -$ pip install pip --upgrade -$ pip install -r requirements.txt -$ python src/models.py -$ ./run.sh -```` +## Build and run +* _Requires Python3.7_ +* Run the installation script: `./install.sh`, this will create a virtual environment in `venv` +* Run the local server: `./run_dev_server.sh`. ## Testing -After building is possible to run unit tests or integration tests against the local server. +After building is possible to run unit tests, or integration tests against the local server. ### unit test with pytest ``` $ pytest tests/unit ``` +or simply `./run_unit_tests.sh` ### integration tests -With a local instance running +With a local instance running with `./run_dev_server.sh` type: ``` $ python -m unittest tests.integration.test_requests.TestExternal ``` +or simply `./run_integration_tests.sh` diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..3bab431 --- /dev/null +++ b/install.sh @@ -0,0 +1,5 @@ +python3.7 -m venv venv && \ +venv/bin/pip install setuptools --upgrade && \ +venv/bin/pip install pip --upgrade && \ +venv/bin/pip install -r requirements.txt && \ +venv/bin/python src/models.py \ No newline at end of file diff --git a/run.sh b/run_dev_server.sh old mode 100644 new mode 100755 similarity index 94% rename from run.sh rename to run_dev_server.sh index d28b507..b4bafdc --- a/run.sh +++ b/run_dev_server.sh @@ -1,7 +1,7 @@ # # uvicorn is a minimal low-level server/application interface for asyncio frameworks # -uvicorn src:app +venv/bin/uvicorn src:app # # Gunicorn is a mature, fully featured server and process manager. diff --git a/run_integration_tests.sh b/run_integration_tests.sh new file mode 100755 index 0000000..9744ca6 --- /dev/null +++ b/run_integration_tests.sh @@ -0,0 +1 @@ +venv/bin/python -m unittest tests.integration.test_requests.TestExternal \ No newline at end of file diff --git a/run_unit_tests.sh b/run_unit_tests.sh new file mode 100755 index 0000000..7051f37 --- /dev/null +++ b/run_unit_tests.sh @@ -0,0 +1 @@ +venv/bin/pytest tests/unit \ No newline at end of file