வலைபெயர்ப்பு சோதனைகள் மற்றும் தொடர்ச்சியான ஒருங்கிணைப்பு¶
தற்போதைய குறியீட்டின் பெரும்பகுதிக்கு டெச்சூட்கள் உள்ளன, எந்தவொரு புதிய செயல்பாட்டிற்கும் சோதனை பெட்டிகளைச் சேர்ப்பதன் மூலம் கவரேசை அதிகரிக்கின்றன, மேலும் அது செயல்படுகிறதா என்பதை சரிபார்க்கவும்.
தொடர்ச்சியான ஒருங்கிணைப்பு¶
Current test results can be found on GitHub Actions and coverage is reported on Codecov.
வெவ்வேறு அம்சங்களை சரிபார்க்க பல வேலைகள் உள்ளன:
அலகு சோதனைகள்
ஆவண உருவாக்கம் மற்றும் வெளிப்புற இணைப்புகள்
ஆதரிக்கப்படும் அனைத்து வெளியீடுகளிலிருந்தும் இடம்பெயர்வு சோதனை
code linting
அமைவு சரிபார்ப்பு (உருவாக்கப்பட்ட மாவட்ட கோப்புகள் எதையும் இழக்காமல் இருப்பதை உறுதி செய்கிறது மற்றும் சோதிக்கப்படலாம்)
The configuration for the CI is in .github/workflows directory. It
heavily uses helper scripts stored in ci directory. The scripts can be
also executed manually, but they require several environment variables, mostly
defining Django settings file to use and test database connection. The example
definition of that is in scripts/test-database.sh:
# Copyright © Michal Čihař <michal@weblate.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
# Simple way to configure test database from environment
# shellcheck shell=sh
# Database backend to use postgresql / mysql / mariadb
export CI_DATABASE="${1:-postgresql}"
# Database server configuration
export CI_DB_USER=weblate
export CI_DB_PASSWORD=weblate
export CI_DB_HOST=127.0.0.1
# Django settings module to use
export DJANGO_SETTINGS_MODULE=weblate.settings_test
எளிய செயலாக்கம் இப்படி இருக்கும்:
source scripts/test-database.sh
./ci/run-migrate
./ci/run-test
./ci/run-docs
உள்ளக சோதனை¶
Before running test, please ensure test dependencies are installed. This can be done by pip install -e .[test].
Pytest ஐப் பயன்படுத்தி சோதனை¶
சோதனைகளை இயக்குவதற்கு முன் நீங்கள் நிலையான கோப்புகளை சேகரிக்க வேண்டும், ஏனெனில் சில சோதனைகள் அவை இருப்பதை நம்பியுள்ளன:
DJANGO_SETTINGS_MODULE=weblate.settings_test ./manage.py collectstatic
உள்நாட்டில் ஒரு டெச்ட்சூட்டை இயக்க நீங்கள் பைடெச்ட் ஐப் பயன்படுத்தலாம்:
pytest weblate
ஒரு தனிப்பட்ட சோதனை கோப்பை இயக்குதல்:
pytest weblate/utils/tests/test_search.py
Hint
You will need a database (PostgreSQL) server to be used for tests. By
default Django creates separate database to run tests with test_ prefix,
so in case your settings is configured to use weblate, the tests will
use test_weblate database. See வலைபெயர்ப்புடுக்கான தரவுத்தள அமைப்பு for setup
instructions.
The weblate/settings_test.py is used in CI environment as well (see
தொடர்ச்சியான ஒருங்கிணைப்பு) and can be tuned using environment variables:
export CI_DATABASE=postgresql
export CI_DB_USER=weblate
export CI_DB_PASSWORD=weblate
export CI_DB_HOST=127.0.0.1
export CI_DB_PORT=60000
export DJANGO_SETTINGS_MODULE=weblate.settings_test
Hint
The tests can also be executed inside developer docker container, see டாக்கரில் உள்நாட்டில் வலைபெயர்ப்பு இயங்குகிறது.
See also
See Testing in Django for more info on running and writing tests for Django.