Files
hello-algo/ja/codes/python/test_all.py
Ikko Eltociear Ashimine 954c45864b docs: add Japanese translate documents (#1812)
* docs: add Japanese documents (`ja/docs`)

* docs: add Japanese documents (`ja/codes`)

* docs: add Japanese documents

* Remove pythontutor blocks in ja/

* Add an empty at the end of each markdown file.

* Add the missing figures (use the English version temporarily).

* Add index.md for Japanese version.

* Add index.html for Japanese version.

* Add missing index.assets

* Fix backtracking_algorithm.md for Japanese version.

* Add avatar_eltociear.jpg. Fix image links on the Japanese landing page.

* Add the Japanese banner.

---------

Co-authored-by: krahets <krahets@163.com>
2025-10-17 05:04:43 +08:00

33 lines
1.0 KiB
Python

import os
import glob
import subprocess
env = os.environ.copy()
env["PYTHONIOENCODING"] = "utf-8"
if __name__ == "__main__":
# ソースコードファイルを検索
src_paths = sorted(glob.glob("ja/codes/python/chapter_*/*.py"))
errors = []
# python コードを実行
for src_path in src_paths:
process = subprocess.Popen(
["python", src_path],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
env=env,
encoding='utf-8'
)
# プロセスの完了を待ち、出力とエラーメッセージを取得
stdout, stderr = process.communicate()
# 終了ステータスをチェック
exit_status = process.returncode
if exit_status != 0:
errors.append(stderr)
print(f"{len(src_paths)} ファイルをテストしました")
print(f"{len(errors)} ファイルで例外が見つかりました")
if len(errors) > 0:
raise RuntimeError("\n\n".join(errors))