Xqt submitted this change.

View Change


Approvals: Xqt: Verified; Looks good to me, approved
[tests] Add tests for sysop rights

Pywikibot account has sysop rights on test-wiki.
Run tests there with sysop rights.

Bug: T245851
Change-Id: Ia50d602ae8ee10d1a83f9a6ea8306acc5df62b30
---
A .github/workflows/sysop_tests-ci.yml
1 file changed, 112 insertions(+), 0 deletions(-)

diff --git a/.github/workflows/sysop_tests-ci.yml b/.github/workflows/sysop_tests-ci.yml
new file mode 100644
index 0000000..0e07bf6
--- /dev/null
+++ b/.github/workflows/sysop_tests-ci.yml
@@ -0,0 +1,99 @@
+name: Sysop CI
+# Run tests using sysop rights
+
+on:
+ push:
+ branches: [ master ]
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+env:
+ PYWIKIBOT_TEST_RUNNING: 1
+ PYWIKIBOT_USERNAME: Pywikibot-oauth
+ PYWIKIBOT_LOGIN_LOGOUT: 1
+
+jobs:
+ build:
+ runs-on: ${{ matrix.os || 'ubuntu-latest' }}
+ timeout-minutes: 2
+
+ strategy:
+ fail-fast: false
+ max-parallel: 15
+
+ matrix:
+ python-version: ["pypy3.7", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12.0-alpha - 3.12.0"]
+ family: ['wikipedia']
+ code: ['test']
+ domain: ['test.wikipedia.org']
+
+ steps:
+ - name: Checkout Repository
+ uses: actions/checkout@v4
+ with:
+ submodules: true
+
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v5
+ with:
+ python-version: ${{ matrix.python-version }}
+
+ - name: Get token name
+ env:
+ _oauth_token: OAUTH_TOKEN_${{ matrix.family }}_${{ matrix.code }}
+ uses: ASzc/change-string-case-action@v5
+ id: token
+ with:
+ string: ${{ env._oauth_token }}
+
+ - name: Split OAuth Token
+ uses: jungwinter/split@v2
+ id: split
+ with:
+ msg: ${{ secrets[format('{0}', steps.token.outputs.uppercase)] }}
+ separator: ":"
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip --version
+ pip install -U setuptools
+ pip install requests
+ pip install mwparserfromhell
+ pip install mwoauth
+ pip install coverage
+ python -c "import setuptools; print('setuptools:', setuptools.__version__)"
+
+ - name: Generate user files
+ run: |
+ python -Werror::UserWarning -m pwb generate_user_files -family:${{matrix.family}} -lang:${{matrix.code}} -user:${{ env.PYWIKIBOT_USERNAME }} -v -debug;
+ echo "authenticate['${{ matrix.domain }}'] = ('${{ steps.split.outputs._0 }}', '${{ steps.split.outputs._1 }}', '${{ steps.split.outputs._2 }}', '${{ steps.split.outputs._3 }}')" >> user-config.py
+ echo "max_retries = 3" >> user-config.py
+ echo "noisysleep = float('inf')" >> user-config.py
+ echo "maximum_GET_length = 5000" >> user-config.py
+ echo "console_encoding = 'utf8'" >> user-config.py
+
+ - name: Sysop tests with pytest
+ id: ci_test
+ continue-on-error: true
+ timeout-minutes: 1
+ env:
+ PYWIKIBOT_TEST_OAUTH: ${{ secrets[format('{0}', steps.token.outputs.uppercase)] }}
+ run: |
+ python pwb.py version
+ pytest -a rights --cov=.;
+
+ - name: Show coverage statistics
+ run: |
+ coverage report
+
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v4
+ env:
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
+
+ - name: Check on failure
+ if: steps.ci_test.outcome == 'failure'
+ run: exit 1

To view, visit change 1003022. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ia50d602ae8ee10d1a83f9a6ea8306acc5df62b30
Gerrit-Change-Number: 1003022
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-MessageType: merged