Aurélien Joga 1f5b590d5a
Python-server workflow fixes + pytest (#17060)
* Fix referenced path for tests

* Explicit dependencies

Flask 2.3 has breaking changes

* Marks all async tests with pytest.mark.asyncio

Otherwise they are skipped by pytest and coverage is zero

* Fix path for pytest

On suggestion from https://github.com/OpenAPITools/openapi-generator/pull/17060#discussion_r1392666369
2023-11-18 10:10:10 +08:00

32 lines
590 B
Bash
Executable File

#!/bin/bash
REQUIREMENTS_FILE=dev-requirements.txt
REQUIREMENTS_OUT=dev-requirements.txt.log
SETUP_OUT=*.egg-info
VENV=.venv
DEACTIVE=false
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
### set virtualenv
if [ -z "$VIRTUAL_ENV" ]; then
virtualenv $VENV --always-copy --python python3
source $VENV/bin/activate
DEACTIVE=true
fi
### install dependencies
pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT
### run tests
tox || exit 1
### static analysis of code
flake8 --show-source ./src
### deactivate virtualenv
if [ $DEACTIVE == true ]; then
deactivate
fi