def test_traceback(mode, entry_point): tb_tool = yc.build_path('library/python/runtime/test/traceback/traceback') stdout_path = yc.test_output_path('stdout_raw.txt') stderr_path = yc.test_output_path('stderr_raw.txt') filtered_stdout_path = yc.test_output_path('stdout.txt') filtered_stderr_path = yc.test_output_path('stderr.txt') env = os.environ.copy() if entry_point == 'custom': env['Y_PYTHON_ENTRY_POINT'] = 'library.python.runtime.test.traceback.crash:main' proc = yc.execute( command=[tb_tool, mode], env=env, stdout=stdout_path, stderr=stderr_path, check_exit_code=False, ) with open(filtered_stdout_path, 'w') as f: f.write(clean_traceback(proc.std_out)) with open(filtered_stderr_path, 'w') as f: f.write(clean_traceback(proc.std_err)) return { 'stdout': yc.canonical_file( filtered_stdout_path, local=True, ), 'stderr': yc.canonical_file( filtered_stderr_path, local=True, ), }
def _get_input_replace_map(): # order matters - source_path is build_path's subdir d = collections.OrderedDict() d[ytc.source_path()] = get_yt_sandbox_path('env/source_path') d[ytc.data_path()] = get_yt_sandbox_path('env/data_path') # yatest.common.binary_path() based on build_path() d[ytc.build_path()] = get_yt_sandbox_path('env/build_path') return d
def _get_input_replace_map(): tmpdir = ytc.misc.first(os.environ.get(var) for var in ['TMPDIR', 'TEMP', 'TMP']) or '/tmp' # order matters - source_path is build_path's subdir d = collections.OrderedDict() d[ytc.source_path()] = 'env/source_path' d[ytc.data_path()] = 'env/data_path' # yatest.common.binary_path() based on build_path() d[ytc.build_path()] = 'env/build_path' d[tmpdir] = 'env/tempdir' return d
def test_run(): runner = yc.build_path('contrib/python/pytz/tests/runner/doctest.pytz') yc.execute(runner)