Skip to content

Commit

Permalink
Add scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Mec-iS committed Feb 11, 2020
1 parent 8e5f0ee commit 00e824a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
21 changes: 8 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

5 changes: 5 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion run.sh → run_dev_server.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 1 addition & 0 deletions run_integration_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
venv/bin/python -m unittest tests.integration.test_requests.TestExternal
1 change: 1 addition & 0 deletions run_unit_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
venv/bin/pytest tests/unit

0 comments on commit 00e824a

Please sign in to comment.