python-telegram-bot/.github/workflows/test.yml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

107 lines
7.7 KiB
YAML
Raw Normal View History

Rename Test suite … (#1750) * Rename Test suite * Actually change the badge in readme * fix download without path arguments (#1591) * fix download without path arguments * fix download without path arguments * solved downloading a file without file_path or custom_path * if no file_path, download as file_id * Add test case * Elaborate doc string Co-authored-by: Bibo-Joshi <hinrich.mahler@freenet.de> * Add default values (#1490) * added parse_mode parameter in Updater and in Bot class to set a default parse mode for bot * DefaultValue * Add default parse_mode everywhere * Renome to default_parse_mode * Test def parse_mode for send_*, edit_message_* * Remove duplicate code in Input* classes * Improve handling of def_p_m for Bot methods * Remove unneeded deletion of kwargs * Make @log preserve signature, add bots with defaults to tests * Fix Codacy * Fix Travis Error * Add default_disable_notification * Add default_disable_web_page_preview * Add default_disable_timeout * add default_disable_web_page_preview for InputTextMessageContent * add default_quote * Try fixing test_pin_and_unpin * Just run 3.5 tests for paranoia * add tests for Defaults * Revert "Just run 3.5 tests for paranoia" This reverts commit 1baa91a3a1f4b352161fe5715a9797f158d9c1b2. * Tidy up parameters, move Defaults to ext * Stage new files, because im an idiot * remove debug prints * change equality checks for DEFAULT_NONE * Some last changes * fix S&R error so that tests actually run Co-authored-by: Ak4zh <agwl.akash@gmail.com> Co-authored-by: Eldinnie <Eldinnie@users.noreply.github.com> * Skip test relying on ordered dicts for 3.5 (#1752) * Rename Test suite * Actually change the badge in readme Co-authored-by: Gabriel Simonetto <42247511+GabrielSimonetto@users.noreply.github.com> Co-authored-by: Ak4zh <agwl.akash@gmail.com> Co-authored-by: Eldinnie <Eldinnie@users.noreply.github.com>
2020-02-06 11:38:21 +01:00
name: GitHub Actions
on:
pull_request:
branches:
- master
push:
branches:
- master
2022-05-03 17:22:30 +02:00
schedule:
# Run monday and friday morning at 03:07 - odd time to spread load on GitHub Actions
- cron: '7 3 * * 1,5'
jobs:
pytest:
name: pytest
runs-on: ${{matrix.os}}
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: False
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -W ignore -m pip install --upgrade pip
python -W ignore -m pip install -U codecov pytest-cov
python -W ignore -m pip install -r requirements.txt
2022-08-26 06:50:03 +02:00
python -W ignore -m pip install -r requirements-opts.txt
python -W ignore -m pip install -r requirements-dev.txt
2022-10-23 14:25:49 +02:00
python -W ignore -m pip install pytest-xdist[psutil]
- name: Test with pytest
2022-08-26 06:50:03 +02:00
# We run 4 different suites here
# 1. Test just utils.datetime.py without pytz being installed
# 2. Test just test_no_passport.py without passport dependencies being installed
2022-08-26 06:50:03 +02:00
# 3. Test just test_rate_limiter.py without passport dependencies being installed
# 4. Test everything else
# The first & second one are achieved by mocking the corresponding import
# See test_helpers.py & test_no_passport.py for details
run: |
pytest -v --cov -k test_no_passport.py
no_passport_exit=$?
2022-08-26 06:50:03 +02:00
export TEST_PASSPORT='true'
pytest -v --cov --cov-append -k test_helpers.py
no_pytz_exit=$?
2022-08-26 06:50:03 +02:00
export TEST_PYTZ='true'
pip uninstall aiolimiter -y
pytest -v --cov --cov-append -k test_ratelimiter.py
no_rate_limiter_exit=$?
export TEST_RATE_LIMITER='true'
pip install -r requirements-opts.txt
2022-10-23 14:25:49 +02:00
# `-n auto --dist loadfile` uses pytest-xdist to run each test file on a different CPU
# worker
pytest -v --cov --cov-append -n auto --dist loadfile
full_exit=$?
special_exit=$(( no_pytz_exit > no_passport_exit ? no_pytz_exit : no_passport_exit ))
2022-08-26 06:50:03 +02:00
special_exit=$(( special_exit > no_rate_limiter_exit ? special_exit : no_rate_limiter_exit ))
global_exit=$(( special_exit > full_exit ? special_exit : full_exit ))
exit ${global_exit}
env:
JOB_INDEX: ${{ strategy.job-index }}
BOTS: W3sidG9rZW4iOiAiNjk2MTg4NzMyO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N0cyBbMF0iLCAic3VwZXJfZ3JvdXBfaWQiOiAiLTEwMDExODU1MDk2MzYiLCAidXNlcm5hbWUiOiAicHRiXzBfYm90In0sIHsidG9rZW4iOiAiMTA0NzMyNjc3MTpBQUY4bk90ODFGcFg4bGJidno4VWV3UVF2UmZUYkZmQnZ1SSIsICJwYXltZW50X3Byb3ZpZGVyX3Rva2VuIjogIjI4NDY4NTA2MzpURVNUOllUVTFOVEk0WkdSallqbGkiLCAibmFtZSI6ICJQVEIgdGVzdHMgWzFdIiwgInN1cGVyX2dyb3VwX2lkIjogIi0xMDAxNDg0Nzk3NjEyIiwgInVzZXJuYW1lIjogInB0Yl8xX2JvdCJ9LCB7InRva2VuIjogIjk3MTk5Mjc0NTpBQUdPa09hVzBOSGpnSXY1LTlqUWJPajR2R3FkaFNGLVV1cyIsICJwYXltZW50X3Byb3ZpZGVyX3Rva2VuIjogIjI4NDY4NTA2MzpURVNUOk5XWmtNV1ZoWWpsallqVTUiLCAibmFtZSI6ICJQVEIgdGVzdHMgWzJdIiwgInN1cGVyX2dyb3VwX2lkIjogIi0xMDAxNDAyMjU1MDcwIiwgInVzZXJuYW1lIjogInB0Yl8yX2JvdCJ9XQ==
2022-08-26 06:50:03 +02:00
TEST_PYTZ : "false"
TEST_PASSPORT: "false"
TEST_RATE_LIMITER: "false"
TEST_BUILD: "true"
shell: bash --noprofile --norc {0}
- name: Submit coverage
uses: codecov/codecov-action@v3
with:
env_vars: OS,PYTHON
name: ${{ matrix.os }}-${{ matrix.python-version }}
fail_ci_if_error: true
test_official:
name: test-official
runs-on: ${{matrix.os}}
strategy:
matrix:
python-version: [3.7]
os: [ubuntu-latest]
fail-fast: False
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -W ignore -m pip install --upgrade pip
python -W ignore -m pip install -r requirements.txt
2022-08-26 06:50:03 +02:00
python -W ignore -m pip install -r requirements-opts.txt
python -W ignore -m pip install -r requirements-dev.txt
- name: Compare to official api
run: |
pytest -v tests/test_official.py
exit $?
env:
TEST_OFFICIAL: "true"
shell: bash --noprofile --norc {0}