3
.gitignore
vendored
3
.gitignore
vendored
@ -15,4 +15,7 @@ node_modules/
|
||||
package-lock.json
|
||||
package.json
|
||||
**.junit.xml
|
||||
**.JUnit.xml
|
||||
feature_flags.json
|
||||
coverage_*.json
|
||||
*-coverage.xml
|
||||
|
16
.vscode/launch.json
vendored
16
.vscode/launch.json
vendored
@ -4,7 +4,6 @@
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
|
||||
{
|
||||
"name": "Centurion",
|
||||
"type": "debugpy",
|
||||
@ -18,7 +17,6 @@
|
||||
"program": "${workspaceFolder}/app/manage.py"
|
||||
},
|
||||
{
|
||||
|
||||
"name": "Debug: Gunicorn",
|
||||
"type": "debugpy",
|
||||
"request": "launch",
|
||||
@ -32,7 +30,6 @@
|
||||
"--bind",
|
||||
"0.0.0.0:8002",
|
||||
"app.wsgi:application",
|
||||
|
||||
],
|
||||
"django": true,
|
||||
"autoStartBrowser": false,
|
||||
@ -53,7 +50,6 @@
|
||||
"autoStartBrowser": false,
|
||||
"program": "${workspaceFolder}/app/manage.py"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "Migrate",
|
||||
"type": "debugpy",
|
||||
@ -64,7 +60,6 @@
|
||||
"django": true,
|
||||
"autoStartBrowser": false,
|
||||
"program": "${workspaceFolder}/app/manage.py"
|
||||
|
||||
},
|
||||
{
|
||||
"name": "Debug: Celery",
|
||||
@ -82,6 +77,17 @@
|
||||
"debug-itsm@%h"
|
||||
],
|
||||
"cwd": "${workspaceFolder}/app"
|
||||
},
|
||||
{
|
||||
"name": "Debug pytest (collect)",
|
||||
"type": "debugpy",
|
||||
"request": "launch",
|
||||
"module": "pytest",
|
||||
"args": [
|
||||
"--collect-only"
|
||||
],
|
||||
"console": "integratedTerminal",
|
||||
"justMyCode": false
|
||||
}
|
||||
]
|
||||
}
|
7
.vscode/settings.json
vendored
7
.vscode/settings.json
vendored
@ -4,13 +4,6 @@
|
||||
"cSpell.enableFiletypes": [
|
||||
"!python"
|
||||
],
|
||||
"python.testing.pytestArgs": [
|
||||
// "-v",
|
||||
// "--cov",
|
||||
// "--cov-report xml",
|
||||
"-s",
|
||||
"app",
|
||||
],
|
||||
"python.testing.unittestEnabled": false,
|
||||
"python.testing.pytestEnabled": true,
|
||||
"testing.coverageToolbarEnabled": true,
|
||||
|
27
app/conftest.py
Normal file
27
app/conftest.py
Normal file
@ -0,0 +1,27 @@
|
||||
import pytest
|
||||
|
||||
from django.test import (
|
||||
TestCase
|
||||
)
|
||||
|
||||
|
||||
|
||||
def pytest_pycollect_makeitem(collector, name, obj):
|
||||
"""PyTest Test Creation
|
||||
|
||||
Create PyTest Test Classes if the classname ends in `Test`
|
||||
and is not inheriting from django,test.TestCase.
|
||||
"""
|
||||
|
||||
if (
|
||||
isinstance(obj, type)
|
||||
and name.endswith("PyTest")
|
||||
and not issubclass(obj, TestCase) # Don't pickup any django unittest.TestCase
|
||||
):
|
||||
return pytest.Class.from_parent(parent=collector, name=name)
|
||||
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def enable_db_access_for_all_tests(db): # pylint: disable=W0613:unused-argument
|
||||
pass
|
@ -1,8 +0,0 @@
|
||||
[pytest]
|
||||
DJANGO_SETTINGS_MODULE = app.settings
|
||||
# -- recommended but optional:
|
||||
python_files = tests.py test_*.py *_tests.py
|
||||
log_cli = 1
|
||||
log_cli_level = INFO
|
||||
log_cli_format = %(asctime)s %(levelname)s %(message)s
|
||||
log_cli_date_format = %Y-%m-%d %H:%M:%S
|
3
makefile
3
makefile
@ -39,16 +39,13 @@ docs: docs-lint
|
||||
lint: markdown-mkdocs-lint
|
||||
|
||||
test:
|
||||
cd app
|
||||
pytest -s --cov --cov-branch --cov-report term --cov-report xml:../artifacts/coverage_unit_functional.xml --cov-report html:../artifacts/coverage/unit_functional/ --junit-xml=../artifacts/unit_functional.JUnit.xml **/tests/unit **/tests/functional
|
||||
|
||||
test-functional:
|
||||
cd app
|
||||
pytest -s --cov --cov-branch --cov-report term --cov-report xml:../artifacts/coverage_functional.xml --cov-report html:../artifacts/coverage/functional/ --junit-xml=../artifacts/functional.JUnit.xml **/tests/functional
|
||||
|
||||
|
||||
test-unit:
|
||||
cd app
|
||||
pytest -s --cov --cov-branch --cov-report term --cov-report xml:../artifacts/coverage_unit.xml --cov-report html:../artifacts/coverage/unit/ --junit-xml=../artifacts/unit.JUnit.xml **/tests/unit
|
||||
|
||||
|
||||
|
@ -17,3 +17,19 @@ init-import = true
|
||||
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
|
||||
addopts = '-s app'
|
||||
|
||||
DJANGO_SETTINGS_MODULE = 'app.settings'
|
||||
# -- recommended but optional:
|
||||
# python_files = 'tests.py test_*.py *_tests.py'
|
||||
log_cli = true
|
||||
log_cli_level = 'INFO'
|
||||
log_cli_format = '%(asctime)s %(levelname)s %(message)s'
|
||||
log_cli_date_format = '%Y-%m-%d %H:%M:%S'
|
||||
|
||||
# testpaths = [
|
||||
# 'tests/*.py',
|
||||
# # 'tests/functional/**/*.py',
|
||||
# # 'tests/unit/**/*.py',
|
||||
# ]
|
Reference in New Issue
Block a user