Skip to content

Commit

Permalink
[tests] Don't cover code with Python 3.13
Browse files Browse the repository at this point in the history
coverage package does not work for Pythom 3.13. Therefore ignore
coverage in that case.

Bug: T346862
Change-Id: I1de5ce9709a652cecc3bf26e19c20ebbabe26430
  • Loading branch information
xqt committed Sep 20, 2023
1 parent 0410134 commit e1749bf
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 5 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/doctest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,24 @@ jobs:
run: |
python -Werror::UserWarning -m pwb generate_user_files -site:wikipedia:test -user:${{ env.PYWIKIBOT_USERNAME }} -v -debug;
- name: doctest with pytest
- name: doctest with pytest and coverage
if: ${{ matrix.python-version != '3.13-dev' }}
timeout-minutes: 5
run: |
python pwb.py version
pytest --version
coverage run -m pytest pywikibot --doctest-modules --ignore-glob="*gui.py" --ignore-glob="*memento.py"
- name: doctest with pytest without coverage due to T346862
if: ${{ matrix.python-version == '3.13-dev' }}
timeout-minutes: 5
run: |
python pwb.py version
pytest --version
pytest pywikibot --doctest-modules --ignore-glob="*gui.py" --ignore-glob="*memento.py"
- name: Show coverage statistics
if: ${{ matrix.python-version != '3.13-dev' }}
run: |
coverage report
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/login_tests-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,22 @@ jobs:
echo "password_file = os.path.expanduser('passwordfile')" >> user-config.py
echo "('${{ env.PYWIKIBOT_USERNAME }}', '${{ secrets.PYWIKIBOT_USERPWD }}')" > passwordfile
- name: Test with unittest
- name: Test with unittest and coverage
if: ${{ matrix.python-version != '3.13-dev' }}
timeout-minutes: 2
run: |
python pwb.py version
coverage run -m unittest -vv tests/site_login_logout_tests.py
- name: Test with unittest without coverage due to T346862
if: ${{ matrix.python-version == '3.13-dev' }}
timeout-minutes: 2
run: |
python pwb.py version
unittest -vv tests/site_login_logout_tests.py
- name: Show coverage statistics
if: ${{ matrix.python-version != '3.13-dev' }}
run: |
coverage report
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/oauth_tests-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,26 @@ jobs:
echo "maximum_GET_length = 5000" >> user-config.py
echo "console_encoding = 'utf8'" >> user-config.py
- name: Test with unittest
- name: Oauth tests with unittest and coverage
if: ${{ matrix.python-version != '3.13-dev' }}
timeout-minutes: 2
env:
PYWIKIBOT_TEST_OAUTH: ${{ secrets[format('{0}', steps.token.outputs.uppercase)] }}
run: |
python pwb.py version
coverage run -m unittest -vv tests/oauth_tests.py
- name: Oauth test with unittest without coverage due to T346862
if: ${{ matrix.python-version == '3.13-dev' }}
timeout-minutes: 2
env:
PYWIKIBOT_TEST_OAUTH: ${{ secrets[format('{0}', steps.token.outputs.uppercase)] }}
run: |
python pwb.py version
unittest -vv tests/oauth_tests.py
- name: Show coverage statistics
if: ${{ matrix.python-version != '3.13-dev' }}
run: |
coverage report
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/pywikibot-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ jobs:
echo "password_file = os.path.expanduser('passwordfile')" >> user-config.py
echo "('${{ env.PYWIKIBOT_USERNAME }}', '${{ secrets.PYWIKIBOT_USERPWD }}')" > passwordfile
- name: Test with unittest or pytest
- name: Test with unittest or pytest and coverage
if: ${{ matrix.python-version != '3.13-dev' }}
id: ci_test
continue-on-error: true
timeout-minutes: 90
Expand All @@ -153,7 +154,21 @@ jobs:
pytest --cov=.;
fi
- name: Test with unittest without coverage due to T346862
if: ${{ matrix.python-version == '3.13-dev' }}
id: ci_test
continue-on-error: true
timeout-minutes: 90
env:
PYWIKIBOT_TEST_NO_RC:
${{ (matrix.site == 'wikisource:zh' || matrix.test_no_rc) && 1 || 0 }}
PYWIKIBOT_TEST_PROD_ONLY: ${{ matrix.test_prod_only && 1 || 0 }}
run: |
python pwb.py version
unittest discover -vv -p \"*_tests.py\";
- name: Show coverage statistics
if: ${{ matrix.python-version != '3.13-dev' }}
run: |
coverage report
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/write_tests-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ jobs:
echo "password_file = os.path.expanduser('passwordfile')" >> user-config.py
echo "('${{ env.PYWIKIBOT_USERNAME }}', '${{ secrets.PYWIKIBOT_USERPWD }}')" > passwordfile
- name: Test with pytest
- name: Write test with pytest and coverage
if: ${{ matrix.python-version != '3.13-dev' }}
id: ci_test
continue-on-error: true
timeout-minutes: 90
Expand All @@ -75,7 +76,19 @@ jobs:
python pwb.py version
pytest -a write --cov=.;
- name: Write test with pytest without coverage due to T346862
if: ${{ matrix.python-version == '3.13-dev' }}
id: ci_test
continue-on-error: true
timeout-minutes: 90
env:
PYWIKIBOT_TEST_WRITE: ${{ matrix.site == 'wikipedia:test' && 1 || 0}}
run: |
python pwb.py version
pytest -a write
- name: Show coverage statistics
if: ${{ matrix.python-version != '3.13-dev' }}
run: |
coverage report
Expand Down

0 comments on commit e1749bf

Please sign in to comment.