diff --git a/.copier-answers.yml b/.copier-answers.yml index 7bbe5ba30..e259ebaed 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: v0.0.94 +_commit: v0.0.94-3-g86b3af6 _src_path: gh:LabAutomationAndScreening/copier-base-template.git description: A web app that is hosted within a local intranet. Nuxt frontend, python backend, docker-compose diff --git a/.gitignore b/.gitignore index 720043812..efe2fb8c9 100644 --- a/.gitignore +++ b/.gitignore @@ -73,8 +73,8 @@ dist # Logs *.log +*.log.* **/logs/log*.txt -**/logs/*.log.* # macOS dev cleanliness **/.DS_Store diff --git a/template/.gitignore b/template/.gitignore index 720043812..efe2fb8c9 100644 --- a/template/.gitignore +++ b/template/.gitignore @@ -73,8 +73,8 @@ dist # Logs *.log +*.log.* **/logs/log*.txt -**/logs/*.log.* # macOS dev cleanliness **/.DS_Store diff --git a/template/README.md.jinja b/template/README.md.jinja index e4ca4452b..b76984c4d 100644 --- a/template/README.md.jinja +++ b/template/README.md.jinja @@ -53,9 +53,19 @@ uv --directory=backend run python src/entrypoint.py When running the unit test suite, the `pytest-recording` library records HTTP requests as cassettes. If you encounter errors about a missing cassette, pass `--record-mode=once` to the `pytest` command to perform a live HTTP request instead.{% endraw %}{% endif %}{% if has_backend %}{% raw %} -To (re)generate the client code this app for use in E2E tests of the backend: + +To (re)generate the client code for this app for use in E2E tests of the backend: + +First, regenerate the openapi.json file that will be used in the next step to generate the Python models: + +```bash +uv --directory=backend run pytest tests/unit/test_basic_server_functionality.py --snapshot-update +``` + +Once created, use Kiota to regenerate all models based on the new openapi.json spec. + ```bash -mkdir -p ./backend/tests/e2e/generated/open_api/backend && docker run --network host -v ./backend/tests/e2e/generated/open_api/backend:/app/output -v ./backend/tests/unit/__snapshots__/test_basic_server_functionality/test_openapi_schema.json:/app/openapi.json mcr.microsoft.com/openapi/kiota:{% endraw %}{{ kiota_cli_version }}{% raw %} generate -l python -c BackendClient -n client -d openapi.json --exclude-backward-compatible --clean-output --additional-data false && uv --directory=backend run python kiota_nullable_fixer.py ./tests/unit/__snapshots__/test_basic_server_functionality/test_openapi_schema.json ./tests/e2e/generated/open_api/backend +mkdir -p "./backend/tests/e2e/generated/open_api/backend" && docker run --network host -v "./backend/tests/e2e/generated/open_api/backend:/app/output" -v "./backend/tests/unit/__snapshots__/test_basic_server_functionality/test_openapi_schema.json:/app/openapi.json" mcr.microsoft.com/openapi/kiota:{% endraw %}{{ kiota_cli_version }}{% raw %} generate -l python -c BackendClient -n client -d openapi.json --exclude-backward-compatible --clean-output --additional-data false && uv --directory=backend run python kiota_nullable_fixer.py "./tests/unit/__snapshots__/test_basic_server_functionality/test_openapi_schema.json" "./tests/e2e/generated/open_api/backend" ```{% endraw %}{% endif %}{% if has_backend and backend_uses_graphql %}{% raw %} To regenerate the GraphQL client code for the E2E test suite, run: diff --git a/template/pytest.ini b/template/pytest.ini index 4a1645444..74b83a9f3 100644 --- a/template/pytest.ini +++ b/template/pytest.ini @@ -1,7 +1,7 @@ [pytest] # Settings managed by the base template norecursedirs = node_modules .precommit_cache .npm_cache .pipenv_cache venv .venv .history -addopts = --cov=src --cov-report html --cov-report term-missing:skip-covered --cov-config=../.coveragerc +addopts = --cov=src --cov-report html --cov-report term-missing:skip-covered --cov-config=./.coveragerc log_cli = 1 log_cli_level = INFO diff --git a/template/{% if has_backend %}backend{% endif %}/.coveragerc b/template/{% if has_backend %}backend{% endif %}/.coveragerc new file mode 120000 index 000000000..50785142b --- /dev/null +++ b/template/{% if has_backend %}backend{% endif %}/.coveragerc @@ -0,0 +1 @@ +../.coveragerc \ No newline at end of file