[New-bugs-announce] [issue35313] test_embed fails in travis CI when tests are executed from a virtual environment
Karthikeyan Singaravelan
report at bugs.python.org
Mon Nov 26 02:41:08 EST 2018
New submission from Karthikeyan Singaravelan <tir.karthi at gmail.com>:
I noticed GCC related test always failing in Travis but it's optional and builds were always green. It's consistent and related to test_embed. It seems that the tests are ran from a virtual environment for GCC that causes some difference in the prefix for the new tests added in test_embed. With virtual environment prefix points to virtual environment path and not to /usr/local. Other tests are ran with built CPython and not with virtual environment hence tests pass. To reproduce this build CPython and activate a virtual environment to run test_embed under the virtual environment. I thought to file it anyway as reference and I don't know if the tests need to be fixed or Travis config.
Sample failure in Travis : https://travis-ci.org/tirkarthi/cpython/builds/459615265
cpython git:(test_embed_travis) ./python.exe -m venv test_venv
cpython git:(test_embed_travis) ./test_venv/bin/python -m test --fail-env-changed -v test.test_embed
== CPython 3.8.0a0 (heads/master:f0e0f2008d, Nov 26 2018, 11:08:07) [Clang 7.0.2 (clang-700.1.81)]
== Darwin-14.4.0-x86_64-i386-64bit little-endian
== cwd: /Users/karthikeyansingaravelan/stuff/python/cpython/build/test_python_11655
== CPU count: 4
== encodings: locale=UTF-8, FS=utf-8
Run tests sequentially
0:00:00 load avg: 2.40 [1/1] test.test_embed
test_bpo20891 (test.test_embed.EmbeddingTests) ... ok
test_forced_io_encoding (test.test_embed.EmbeddingTests) ... ok
test_initialize_pymain (test.test_embed.EmbeddingTests) ... ok
test_initialize_twice (test.test_embed.EmbeddingTests) ... ok
test_pre_initialization_api (test.test_embed.EmbeddingTests) ... ok
test_pre_initialization_sys_options (test.test_embed.EmbeddingTests) ... ok
test_subinterps_different_ids (test.test_embed.EmbeddingTests) ... ok
test_subinterps_distinct_state (test.test_embed.EmbeddingTests) ... ok
test_subinterps_main (test.test_embed.EmbeddingTests) ... ok
test_init_default_config (test.test_embed.InitConfigTests) ... FAIL
test_init_dev_mode (test.test_embed.InitConfigTests) ... FAIL
test_init_env (test.test_embed.InitConfigTests) ... FAIL
test_init_from_config (test.test_embed.InitConfigTests) ... FAIL
test_init_global_config (test.test_embed.InitConfigTests) ... FAIL
test_init_isolated (test.test_embed.InitConfigTests) ... FAIL
======================================================================
FAIL: test_init_default_config (test.test_embed.InitConfigTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 488, in test_init_default_config
self.check_config("init_default_config", {})
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 483, in check_config
self.check_core_config(config, expected, env)
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 450, in check_core_config
self.assertEqual(core_config, expected)
AssertionError: {'ins[248 chars] 0, 'coerce_c_locale': 0, 'coerce_c_locale_war[722 chars]': 0} != {'ins[248 chars] 0, 'filesystem_encoding': 'utf-8', 'filesyste[824 chars]': 0}
{'_check_hash_pycs_mode': 'default',
'_frozen': 0,
'_install_importlib': 1,
'allocator': None,
'argv': [],
'base_exec_prefix': '/usr/local',
'base_prefix': '/usr/local',
'buffered_stdio': 1,
'bytes_warning': 0,
'coerce_c_locale': 0,
'coerce_c_locale_warn': 0,
'dev_mode': 0,
'dump_refs': 0,
- 'exec_prefix': '/usr/local',
+ 'exec_prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv',
'faulthandler': 0,
'filesystem_encoding': 'utf-8',
'filesystem_errors': 'surrogateescape',
'hash_seed': 0,
'home': None,
'import_time': 0,
'inspect': 0,
'install_signal_handlers': 1,
'interactive': 0,
'isolated': 0,
'malloc_stats': 0,
'module_search_path_env': None,
'optimization_level': 0,
'parser_debug': 0,
- 'prefix': '/usr/local',
+ 'prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv',
'program': None,
'program_name': './_testembed',
'pycache_prefix': None,
'quiet': 0,
'show_alloc_count': 0,
'show_ref_count': 0,
'site_import': 1,
'stdio_encoding': 'utf-8',
'stdio_errors': 'strict',
'tracemalloc': 0,
'use_environment': 1,
'use_hash_seed': 0,
'user_site_directory': 1,
'utf8_mode': 0,
'verbose': 0,
'warnoptions': [],
'write_bytecode': 1,
'xoptions': []}
======================================================================
FAIL: test_init_dev_mode (test.test_embed.InitConfigTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 586, in test_init_dev_mode
self.check_config("init_dev_mode", config)
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 483, in check_config
self.check_core_config(config, expected, env)
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 450, in check_core_config
self.assertEqual(core_config, expected)
AssertionError: {'ins[251 chars] 0, 'coerce_c_locale': 0, 'coerce_c_locale_war[722 chars]': 0} != {'ins[251 chars] 0, 'filesystem_encoding': 'utf-8', 'filesyste[824 chars]': 0}
{'_check_hash_pycs_mode': 'default',
'_frozen': 0,
'_install_importlib': 1,
'allocator': 'debug',
'argv': [],
'base_exec_prefix': '/usr/local',
'base_prefix': '/usr/local',
'buffered_stdio': 1,
'bytes_warning': 0,
'coerce_c_locale': 0,
'coerce_c_locale_warn': 0,
'dev_mode': 1,
'dump_refs': 0,
- 'exec_prefix': '/usr/local',
+ 'exec_prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv',
'faulthandler': 1,
'filesystem_encoding': 'utf-8',
'filesystem_errors': 'surrogateescape',
'hash_seed': 0,
'home': None,
'import_time': 0,
'inspect': 0,
'install_signal_handlers': 1,
'interactive': 0,
'isolated': 0,
'malloc_stats': 0,
'module_search_path_env': None,
'optimization_level': 0,
'parser_debug': 0,
- 'prefix': '/usr/local',
+ 'prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv',
'program': None,
'program_name': './_testembed',
'pycache_prefix': None,
'quiet': 0,
'show_alloc_count': 0,
'show_ref_count': 0,
'site_import': 1,
'stdio_encoding': 'utf-8',
'stdio_errors': 'strict',
'tracemalloc': 0,
'use_environment': 1,
'use_hash_seed': 0,
'user_site_directory': 1,
'utf8_mode': 0,
'verbose': 0,
'warnoptions': [],
'write_bytecode': 1,
'xoptions': []}
======================================================================
FAIL: test_init_env (test.test_embed.InitConfigTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 578, in test_init_env
self.check_config("init_env", config)
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 483, in check_config
self.check_core_config(config, expected, env)
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 450, in check_core_config
self.assertEqual(core_config, expected)
AssertionError: {'ins[259 chars] 1, 'coerce_c_locale': 0, 'coerce_c_locale_war[743 chars]': 0} != {'ins[259 chars] 1, 'filesystem_encoding': 'utf-8', 'filesyste[845 chars]': 0}
{'_check_hash_pycs_mode': 'default',
'_frozen': 0,
'_install_importlib': 1,
'allocator': 'malloc_debug',
'argv': [],
'base_exec_prefix': '/usr/local',
'base_prefix': '/usr/local',
'buffered_stdio': 0,
'bytes_warning': 0,
'coerce_c_locale': 0,
'coerce_c_locale_warn': 0,
'dev_mode': 1,
'dump_refs': 0,
- 'exec_prefix': '/usr/local',
+ 'exec_prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv',
'faulthandler': 1,
'filesystem_encoding': 'utf-8',
'filesystem_errors': 'surrogateescape',
'hash_seed': 42,
'home': None,
'import_time': 1,
'inspect': 1,
'install_signal_handlers': 1,
'interactive': 0,
'isolated': 0,
'malloc_stats': 1,
'module_search_path_env': None,
'optimization_level': 2,
'parser_debug': 0,
- 'prefix': '/usr/local',
+ 'prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv',
'program': None,
'program_name': './_testembed',
'pycache_prefix': 'env_pycache_prefix',
'quiet': 0,
'show_alloc_count': 0,
'show_ref_count': 0,
'site_import': 1,
'stdio_encoding': 'iso8859-1',
'stdio_errors': 'replace',
'tracemalloc': 2,
'use_environment': 1,
'use_hash_seed': 1,
'user_site_directory': 0,
'utf8_mode': 1,
'verbose': 1,
'warnoptions': [],
'write_bytecode': 0,
'xoptions': []}
======================================================================
FAIL: test_init_from_config (test.test_embed.InitConfigTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 553, in test_init_from_config
self.check_config("init_from_config", config)
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 483, in check_config
self.check_core_config(config, expected, env)
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 450, in check_core_config
self.assertEqual(core_config, expected)
AssertionError: {'ins[260 chars] 1, 'coerce_c_locale': 0, 'coerce_c_locale_war[859 chars]': 1} != {'ins[260 chars] 1, 'filesystem_encoding': 'utf-8', 'filesyste[961 chars]': 1}
{'_check_hash_pycs_mode': 'always',
'_frozen': 1,
'_install_importlib': 1,
'allocator': 'malloc_debug',
'argv': ['-c', 'pass'],
'base_exec_prefix': '/usr/local',
'base_prefix': '/usr/local',
'buffered_stdio': 0,
'bytes_warning': 1,
'coerce_c_locale': 0,
'coerce_c_locale_warn': 0,
'dev_mode': 0,
'dump_refs': 0,
- 'exec_prefix': '/usr/local',
+ 'exec_prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv',
'faulthandler': 1,
'filesystem_encoding': 'utf-8',
'filesystem_errors': 'surrogateescape',
'hash_seed': 123,
'home': None,
'import_time': 1,
'inspect': 1,
'install_signal_handlers': 0,
'interactive': 1,
'isolated': 0,
'malloc_stats': 1,
'module_search_path_env': None,
'optimization_level': 2,
'parser_debug': 0,
- 'prefix': '/usr/local',
+ 'prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv',
'program': 'conf_program',
'program_name': './conf_program_name',
'pycache_prefix': 'conf_pycache_prefix',
'quiet': 1,
'show_alloc_count': 1,
'show_ref_count': 1,
'site_import': 0,
'stdio_encoding': 'iso8859-1',
'stdio_errors': 'replace',
'tracemalloc': 2,
'use_environment': 1,
'use_hash_seed': 1,
'user_site_directory': 0,
'utf8_mode': 1,
'verbose': 1,
'warnoptions': ['default', 'error::ResourceWarning'],
'write_bytecode': 0,
'xoptions': ['core_xoption1=3', 'core_xoption2=', 'core_xoption3']}
======================================================================
FAIL: test_init_global_config (test.test_embed.InitConfigTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 511, in test_init_global_config
self.check_config("init_global_config", config)
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 483, in check_config
self.check_core_config(config, expected, env)
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 450, in check_core_config
self.assertEqual(core_config, expected)
AssertionError: {'ins[248 chars] 0, 'coerce_c_locale': 0, 'coerce_c_locale_war[730 chars]': 1} != {'ins[248 chars] 0, 'filesystem_encoding': 'utf-8', 'filesyste[832 chars]': 1}
{'_check_hash_pycs_mode': 'default',
'_frozen': 1,
'_install_importlib': 1,
'allocator': None,
'argv': [],
'base_exec_prefix': '/usr/local',
'base_prefix': '/usr/local',
'buffered_stdio': 0,
'bytes_warning': 1,
'coerce_c_locale': 0,
'coerce_c_locale_warn': 0,
'dev_mode': 0,
'dump_refs': 0,
- 'exec_prefix': '/usr/local',
+ 'exec_prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv',
'faulthandler': 0,
'filesystem_encoding': 'utf-8',
'filesystem_errors': 'surrogateescape',
'hash_seed': 0,
'home': None,
'import_time': 0,
'inspect': 1,
'install_signal_handlers': 1,
'interactive': 1,
'isolated': 0,
'malloc_stats': 0,
'module_search_path_env': None,
'optimization_level': 2,
'parser_debug': 0,
- 'prefix': '/usr/local',
+ 'prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv',
'program': None,
'program_name': './globalvar',
'pycache_prefix': None,
'quiet': 1,
'show_alloc_count': 0,
'show_ref_count': 0,
'site_import': 0,
'stdio_encoding': 'utf-8',
'stdio_errors': 'surrogateescape',
'tracemalloc': 0,
'use_environment': 1,
'use_hash_seed': 0,
'user_site_directory': 0,
'utf8_mode': 1,
'verbose': 1,
'warnoptions': [],
'write_bytecode': 0,
'xoptions': []}
======================================================================
FAIL: test_init_isolated (test.test_embed.InitConfigTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 594, in test_init_isolated
self.check_config("init_isolated", config)
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 483, in check_config
self.check_core_config(config, expected, env)
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 450, in check_core_config
self.assertEqual(core_config, expected)
AssertionError: {'ins[248 chars] 0, 'coerce_c_locale': 0, 'coerce_c_locale_war[722 chars]': 0} != {'ins[248 chars] 0, 'filesystem_encoding': 'utf-8', 'filesyste[824 chars]': 0}
{'_check_hash_pycs_mode': 'default',
'_frozen': 0,
'_install_importlib': 1,
'allocator': None,
'argv': [],
'base_exec_prefix': '/usr/local',
'base_prefix': '/usr/local',
'buffered_stdio': 1,
'bytes_warning': 0,
'coerce_c_locale': 0,
'coerce_c_locale_warn': 0,
'dev_mode': 0,
'dump_refs': 0,
- 'exec_prefix': '/usr/local',
+ 'exec_prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv',
'faulthandler': 0,
'filesystem_encoding': 'utf-8',
'filesystem_errors': 'surrogateescape',
'hash_seed': 0,
'home': None,
'import_time': 0,
'inspect': 0,
'install_signal_handlers': 1,
'interactive': 0,
'isolated': 1,
'malloc_stats': 0,
'module_search_path_env': None,
'optimization_level': 0,
'parser_debug': 0,
- 'prefix': '/usr/local',
+ 'prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv',
'program': None,
'program_name': './_testembed',
'pycache_prefix': None,
'quiet': 0,
'show_alloc_count': 0,
'show_ref_count': 0,
'site_import': 1,
'stdio_encoding': 'utf-8',
'stdio_errors': 'strict',
'tracemalloc': 0,
'use_environment': 0,
'use_hash_seed': 0,
'user_site_directory': 0,
'utf8_mode': 0,
'verbose': 0,
'warnoptions': [],
'write_bytecode': 1,
'xoptions': []}
----------------------------------------------------------------------
Ran 15 tests in 11.761s
FAILED (failures=6)
test test.test_embed failed
test.test_embed failed
== Tests result: FAILURE ==
1 test failed:
test.test_embed
Total duration: 11 sec 931 ms
Tests result: FAILURE
----------
components: Tests
messages: 330406
nosy: pablogsal, vstinner, xtreak
priority: normal
severity: normal
status: open
title: test_embed fails in travis CI when tests are executed from a virtual environment
versions: Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35313>
_______________________________________
More information about the New-bugs-announce
mailing list