jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[tests] skip site_login_logout tests if environment var is not set

Bug: T298761
Change-Id: I42495a466a83ec47078a238a66dc740cc0256d98
---
M .github/workflows/login_tests-ci.yml
M .github/workflows/pywikibot-ci.yml
M tests/site_login_logout_tests.py
3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/login_tests-ci.yml b/.github/workflows/login_tests-ci.yml
index c4a7f37..85d92d2 100644
--- a/.github/workflows/login_tests-ci.yml
+++ b/.github/workflows/login_tests-ci.yml
@@ -6,13 +6,14 @@

on:
workflow_run:
- workflows: [ "pywikibot-ci" ]
+ workflows: [ "Pywikibot CI" ]
branches: [ master, stable ]
types:
- completed

env:
PYWIKIBOT_TESTS_RUNNING: 1
+ PYWIKIBOT_LOGIN_LOGOUT: 1
PYWIKIBOT_USERNAME: Pywikibot-test

jobs:
diff --git a/.github/workflows/pywikibot-ci.yml b/.github/workflows/pywikibot-ci.yml
index 712e989..6631832 100644
--- a/.github/workflows/pywikibot-ci.yml
+++ b/.github/workflows/pywikibot-ci.yml
@@ -21,7 +21,7 @@

strategy:
fail-fast: false
- max-parallel: 8
+ max-parallel: 9

matrix:
python-version: ["pypy3", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"]
@@ -91,7 +91,7 @@

- name: Generate user files
run: |
- if [ ${{matrix.site}} != 'False' ]; then
+ if [ ${{matrix.site}} != false ]; then
python -Werror::UserWarning -m pwb generate_user_files -site:${{matrix.site}} -user:${{ env.PYWIKIBOT_USERNAME }} -v -debug;
else
python -Werror::UserWarning -m pwb generate_user_files -family:${{matrix.family}} -lang:${{matrix.code}} -user:${{ env.PYWIKIBOT_USERNAME }} -v -debug;
diff --git a/tests/site_login_logout_tests.py b/tests/site_login_logout_tests.py
index df1ba45..d53ff30 100644
--- a/tests/site_login_logout_tests.py
+++ b/tests/site_login_logout_tests.py
@@ -5,6 +5,7 @@
#
# Distributed under the terms of the MIT license.
#
+import os
import unittest
from contextlib import suppress

@@ -50,6 +51,12 @@
self.assertIsNone(site.user())


+def setUpModule(): # noqa: N802
+ """Skip tests if PYWIKIBOT_LOGIN_LOGOUT variable is not set."""
+ if os.environ.get('PYWIKIBOT_LOGIN_LOGOUT', '0') != '1':
+ raise unittest.SkipTest('login/logout tests ar disabled')
+
+
if __name__ == '__main__': # pragma: no cover
with suppress(SystemExit):
unittest.main()

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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I42495a466a83ec47078a238a66dc740cc0256d98
Gerrit-Change-Number: 752715
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged