Page MenuHomePhabricator

Translation updates to pywikibot are blocked: pywikibot-i18n-tox-docker has started failing
Closed, ResolvedPublic

Description

https://integration.wikimedia.org/ci/job/pywikibot-i18n-tox-docker/263/console

14:24:38 + python -m unittest -v tests/l10n_tests.py
14:24:39 Traceback (most recent call last):
14:24:39   File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
14:24:39     "__main__", mod_spec)
14:24:39   File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
14:24:39     exec(code, run_globals)
14:24:39   File "/usr/lib/python3.7/unittest/__main__.py", line 18, in <module>
14:24:39     main(module=None)
14:24:39   File "/usr/lib/python3.7/unittest/main.py", line 100, in __init__
14:24:39     self.parseArgs(argv)
14:24:39   File "/usr/lib/python3.7/unittest/main.py", line 147, in parseArgs
14:24:39     self.createTests()
14:24:39   File "/usr/lib/python3.7/unittest/main.py", line 159, in createTests
14:24:39     self.module)
14:24:39   File "/usr/lib/python3.7/unittest/loader.py", line 220, in loadTestsFromNames
14:24:39     suites = [self.loadTestsFromName(name, module) for name in names]
14:24:39   File "/usr/lib/python3.7/unittest/loader.py", line 220, in <listcomp>
14:24:39     suites = [self.loadTestsFromName(name, module) for name in names]
14:24:39   File "/usr/lib/python3.7/unittest/loader.py", line 154, in loadTestsFromName
14:24:39     module = __import__(module_name)
14:24:39   File "/src/.tox/py37/tmp/pywikibot-build/tests/__init__.py", line 28, in <module>
14:24:39     import pywikibot.data.api
14:24:39   File "/src/.tox/py37/tmp/pywikibot-build/pywikibot/__init__.py", line 19, in <module>
14:24:39     from pywikibot import config as _config
14:24:39   File "/src/.tox/py37/tmp/pywikibot-build/pywikibot/config.py", line 417, in <module>
14:24:39     base_dir = get_base_dir(config_file=user_config_file)
14:24:39   File "/src/.tox/py37/tmp/pywikibot-build/pywikibot/config.py", line 406, in get_base_dir
14:24:39     raise RuntimeError(exc_text)
14:24:39 RuntimeError: No user-config.py found in directory '/src/.tox/py37/tmp/pywikibot-build'.
14:24:39 
14:24:39 Please check that user-config.py is stored in the correct location.
14:24:39 Directory where user-config.py is searched is determined as follows:
14:24:39 
14:24:39     Return the directory in which user-specific information is stored.
14:24:39 
14:24:39     This is determined in the following order:
14:24:39      1.  If the script was called with a `-dir:` argument, use the
14:24:39          directory provided in this argument.
14:24:39      2.  If the user has a `PYWIKIBOT_DIR` environment variable, use the
14:24:39          value of it.
14:24:39      3.  If `user-config` is present in current directory, use the
14:24:39          current directory.
14:24:39      4.  If `user-config` is present in `pwb.py` directory, use that
14:24:39          directory
14:24:39      5.  Use (and if necessary create) a `'pywikibot'` folder under
14:24:39          `'Application Data'` or `'AppData\Roaming'` (Windows) or
14:24:39          `'.pywikibot'` directory (Unix and similar) under the user's
14:24:39          home directory.
14:24:39 
14:24:39     Set `PYWIKIBOT_NO_USER_CONFIG=1` to disable loading user config file
14:24:39     (`user-config.py`) or install Pywikibot as a site-package.
14:24:39 
14:24:39     .. versionchanged:: 7.7
14:24:39        Added the *config_file* parameter.
14:24:39 
14:24:39     :param test_directory: Assume that a user config file exists in this
14:24:39         directory. Used to test whether placing a user config file in this
14:24:39         directory will cause it to be selected as the base directory.
14:24:39     :param config_file: filename of the user config file
14:24:39     
14:24:39 py37: exit 1 (1.77 seconds) /src> ./run-tests.sh /src/.tox/py37/tmp pid=76
14:24:39   py37: FAIL code 1 (5.90=setup[4.13]+cmd[1.77] seconds)

https://gerrit.wikimedia.org/r/q/project:pywikibot%252Fi18n --> passed Oct 9th, failing since Oct 16th

Event Timeline

looks like the setting

PYWIKIBOT_NO_USER_CONFIG=2

is not respected here but it works for the Pywikibot CI (rPWBC) as well as for rPBXQ.

Does it has to do with rCICF12124c4 or rCICF368c3f647?

Change 971949 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/i18n@master] [CI] set PYWIKIBOT_NO_USER_CONFIG environemt variable

https://gerrit.wikimedia.org/r/971949

@hashar: Does the TOX_OVERRIDE=testenv.pass_env=XDG_CACHE_HOME,testenv.set_env=PY_COLORS=1 override the tox setenv?

@hashar: Does the TOX_OVERRIDE=testenv.pass_env=XDG_CACHE_HOME,testenv.set_env=PY_COLORS=1 override the tox setenv?

With tox v4 yes possibly :-(

Looks like it is better to set the environment variable in the shell script as you have proposed!

Change 971949 merged by jenkins-bot:

[pywikibot/i18n@master] [CI] set PYWIKIBOT_NO_USER_CONFIG environment variable within shell

https://gerrit.wikimedia.org/r/971949

It is possible that CI injecting TOX_OVERRIDE=testenv.pass_env=XDG_CACHE_HOME,testenv.set_env=PY_COLORS=1 cause it to completely override pass_env and set_env set in the repo tox.ini :-\ That was done as part of T348871: tox v4 replacement for TOX_TESTENV_PASSENV and I commented about that issue on that task.

The tox v4 upgrade is unfortunately not straightforward.