-
Notifications
You must be signed in to change notification settings - Fork 4
62 lines (49 loc) · 1.35 KB
/
Backend_pytest.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Test Backend
on:
push:
branches:
- master
paths:
- Backend/**/*.py
pull_request:
branches:
- master
paths:
- Backend/**/*.py
jobs:
pytest:
name: Pytest
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set Up Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install Python Requirements
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
working-directory: Backend
- name: Test with pytest
run: |
# install pytest and useful wrappers
pip install pytest
pip install pytest-asyncio
pip install pytest_mock
pip install aiosqlite
pip install httpx
# make sure the db runs
docker-compose run -d -p 5432:5432 postgres
docker-compose run -d -p 6379:6379 redis
# add the env varible we need to connect to the db
export $(grep -v '^#' .env | xargs -d '\n')
# change the redis env var
export REDIS_HOST=localhost
# add the dir to pythonpath
export PYTHONPATH="${PYTHONPATH}:/home/runner/work/elevatorbot"
# rename the settings file
sudo mv rename_to_settings.toml settings.toml
# run tests
pytest Backend