Page MenuHomePhabricator

python 2.7 script_tests fails with unicode values in env on Windows
Closed, ResolvedPublic

Description

When running script tests on Python 2.7.13 every test fails with

TypeError: environment can only contain strings: unicode in os.environ: [(u'PYWIKIBOT_DIR_PWB', '')]

See also T108035

Complete traceback for one test:

======================================================================
ERROR: test_wikisourcetext (tests.script_tests.TestScriptSimulate)
Test running wikisourcetext -simulate.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\pwb\GIT\core\tests\script_tests.py", line 266, in testScript
    error=error, overrides=test_overrides)
  File "C:\pwb\GIT\core\tests\utils.py", line 749, in execute_pwb
    data_in=data_in, timeout=timeout, error=error)
  File "C:\pwb\GIT\core\tests\utils.py", line 684, in execute
    '{}: unicode in os.environ: {!r}'.format(e, unicode_env))
TypeError: environment can only contain strings: unicode in os.environ: [(u'PYWIKIBOT_DIR_PWB', '')]

----------------------------------------------------------------------

Event Timeline

Xqt triaged this task as Medium priority.Nov 17 2018, 3:38 PM

Change 474471 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [FIX] Any environment variable added on Windows must be of type str on py 2

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

Change 474471 merged by jenkins-bot:
[pywikibot/core@master] [FIX] Any environment variable added on Windows must be of type str on py 2

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