pytest 1.0 and makefile
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,6 +7,7 @@ __pycache__/
|
||||
*.pyc
|
||||
*.pyo
|
||||
*.pyd
|
||||
*.pytest_cache
|
||||
|
||||
# IDE и редакторы
|
||||
.vscode/
|
||||
|
||||
18
makefile
Normal file
18
makefile
Normal file
@@ -0,0 +1,18 @@
|
||||
VENV=./venv/bin/python
|
||||
ALEMBIC=alembic -c ./server/database/alembic/alembic.ini
|
||||
|
||||
.PHONY: test run migrate_head migrate_down migrate_history migrate_current migrate
|
||||
test:
|
||||
pytest -c ./server/testing/pytest.ini ./server/testing/tests/
|
||||
run:
|
||||
$(VENV) run.py
|
||||
migrate_head:
|
||||
$(ALEMBIC) upgrade head
|
||||
migrate_down:
|
||||
$(ALEMBIC) downgrade -1
|
||||
migrate_history:
|
||||
$(ALEMBIC) history
|
||||
migrate_current:
|
||||
$(ALEMBIC) current
|
||||
migrate:
|
||||
$(ALEMBIC) revision --autogenerate
|
||||
@@ -6,4 +6,5 @@ greenlet == 3.2.4
|
||||
passlib == 1.7.4
|
||||
bcrypt == 4.0.1
|
||||
python-jose[cryptography] == 3.5.0
|
||||
alembic == 1.16.5
|
||||
alembic == 1.16.5
|
||||
pytest == 8.4.1
|
||||
8
server/testing/pytest.ini
Normal file
8
server/testing/pytest.ini
Normal file
@@ -0,0 +1,8 @@
|
||||
[pytest]
|
||||
minversion = 6.0
|
||||
testpaths = tests
|
||||
python_files = test_*.py *_test.py
|
||||
python_functions = test_*
|
||||
addopts =
|
||||
-vv
|
||||
--import-mode=importlib
|
||||
7
server/testing/tests/first_test.py
Normal file
7
server/testing/tests/first_test.py
Normal file
@@ -0,0 +1,7 @@
|
||||
# test_math.py
|
||||
def add(a, b):
|
||||
return a + b
|
||||
|
||||
def test_addition():
|
||||
assert add(2, 2) == 4
|
||||
assert add(-1, 1) == 0
|
||||
Reference in New Issue
Block a user