Page MenuHomePhabricator

Prevent printing of environment variables during tests
Closed, ResolvedPublic

Description

From https://integration.wikimedia.org/ci/job/pywikibot-core-tox-doc-docker/3742/console:

reading sources... [ 52%] api_ref/tests/page_tests
reading sources... [ 53%] api_ref/tests/pagegenerators_tests
reading sources... [ 54%] api_ref/tests/paraminfo_tests
reading sources... [ 55%] api_ref/tests/patrolbot_tests
reading sources... [ 56%] api_ref/tests/plural_tests
reading sources... [ 56%] api_ref/tests/proofreadpage_tests
reading sources... [ 57%] api_ref/tests/protectbot_tests
reading sources... [ 58%] api_ref/tests/pwb
reading sources... [ 59%] api_ref/tests/pwb.print_env
os.environ:
'BASE_LOG_PATH': '99/459499/3'
'BUILD_DISPLAY_NAME': '#3742'
'BUILD_ID': '3742'
'BUILD_NUMBER': '3742'
'BUILD_TAG': 'jenkins-pywikibot-core-tox-doc-docker-3742'
'BUILD_TIMEOUT': '30'
[...]

This is because tests/pwb.print_env.py does not have a if __name__ == '__main__': ... statement.

Event Timeline

Change 459777 had a related patch set uploaded (by Dalba; owner: dalba):
[pywikibot/core@master] tests/pwb: Put the main body of the scripts in a if name == 'main': ...

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

Change 459777 merged by jenkins-bot:
[pywikibot/core@master] tests/pwb: Put the main body of the scripts in a if __name__ == '__main__':

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