Setup env vars for tests

This commit is contained in:
Stéphane Bidoul 2021-11-05 21:26:55 +01:00
parent 5f46b29886
commit 3339259346
No known key found for this signature in database
GPG key ID: BCAB2555446B5B92
5 changed files with 36 additions and 6 deletions

13
.env.test Normal file
View file

@ -0,0 +1,13 @@
RUNBOAT_SUPPORTED_REPOS=["OCA/mis-builder", "shopinvader/odoo-shopinvader", "OCA/server-env"]
RUNBOAT_API_ADMIN_USER="admin"
RUNBOAT_API_ADMIN_PASSWD="admin"
RUNBOAT_BUILD_NAMESPACE=runboat-builds
RUNBOAT_BUILD_PGHOST=postgres14.runboat-builds-db
RUNBOAT_BUILD_PGPORT=5432
RUNBOAT_BUILD_PGUSER=runboat-build
RUNBOAT_BUILD_PGPASSWORD=...
RUNBOAT_BUILD_ADMIN_PASSWD=...
RUNBOAT_BUILD_DOMAIN=runboat.odoo-community.org
RUNBOAT_BUILD_ENV={}
RUNBOAT_GITHUB_TOKEN=
RUNBOAT_LOG_CONFIG=log-config.yaml

View file

@ -22,8 +22,8 @@ jobs:
- name: Install project - name: Install project
run: | run: |
pip install -U "pip>=21.3.1" pip install -U "pip>=21.3.1"
pip install -e .[test] -c requirements.txt pip install -e .[test] -c requirements.txt -c requirements-test.txt
- name: Run tests - name: Run tests
run: | run: |
pytest -v --cov --cov-report=xml pytest -v --cov --cov-report=xml ./tests
- uses: codecov/codecov-action@v1 - uses: codecov/codecov-action@v1

View file

@ -68,8 +68,10 @@ in a different cluster.
- setup environment variables (start from `.env.sample`) - setup environment variables (start from `.env.sample`)
- create a virtualenv, make sure to have pip>=21.3.1 and `pip install -c - create a virtualenv, make sure to have pip>=21.3.1 and `pip install -c
requirements.txt -e .` requirements.txt -e .[test]`
- run with `uvicorn runboat.app:app --log-config=log-config.yaml` - run with `uvicorn runboat.app:app --log-config=log-config.yaml`
- run tests with `pytest` (environment variables used in tests are declared in
`.env.test`)
## Running in production ## Running in production

View file

@ -24,9 +24,7 @@ dynamic = ["version", "description"]
test = [ test = [
"pytest", "pytest",
"pytest-cov", "pytest-cov",
] "pytest-dotenv",
mypy = [
"mypy",
] ]
[project.urls] [project.urls]
@ -35,4 +33,7 @@ Home = "https://github.com/sbidoul/runboat"
[tool.isort] [tool.isort]
profile = 'black' profile = 'black'
[tool.pytest.ini_options]
env_files = [".env.test"]
# flake8 config is in .flake8 # flake8 config is in .flake8

14
requirements-test.txt Normal file
View file

@ -0,0 +1,14 @@
# frozen requirements generated by pip-deepfreeze
attrs==21.2.0
coverage==6.1.1
iniconfig==1.1.1
packaging==21.2
pluggy==1.0.0
py==1.11.0
pyparsing==2.4.7
pytest==6.2.5
pytest-cov==3.0.0
pytest-dotenv==0.5.2
python-dotenv==0.19.1
toml==0.10.2
tomli==1.2.2