diff --git a/tests/test_execution_engine.py b/tests/test_execution_engine.py index 6f5d5bf..d344fe0 100644 --- a/tests/test_execution_engine.py +++ b/tests/test_execution_engine.py @@ -1,3 +1,4 @@ +import sys import pytest import subprocess from unittest.mock import Mock, patch @@ -61,26 +62,6 @@ def test_run_python_file_error(mock_run, engine, tmp_path): assert "ZeroDivisionError" in result["stderr"] -# --------------------------------------------------------- -# 3. LaTeX-Datei wird kompiliert -# --------------------------------------------------------- - -@patch("subprocess.run") -def test_run_tex_file_success(mock_run, engine, tmp_path): - file = tmp_path / "doc.tex" - file.write_text("\\documentclass{article}") - - mock_run.return_value = Mock( - stdout="PDF created", - stderr="", - returncode=0 - ) - - result = engine.run_code(file) - - assert result["rc"] == 0 - assert "PDF created" in result["stdout"] - # --------------------------------------------------------- # 4. Unsupported File Type @@ -327,34 +308,13 @@ def test_run_unicode_filename(mock_run, engine, tmp_path): assert result["rc"] == 0 + # --------------------------------------------------------- -# 16. .tex nutzt pdflatex +# 17. .py nutzt sys.executable als Interpreter # --------------------------------------------------------- @patch("subprocess.run") -def test_tex_uses_pdflatex(mock_run, engine, tmp_path): - file = tmp_path / "doc.tex" - file.write_text("x") - - mock_run.return_value = Mock( - stdout="", - stderr="", - returncode=0 - ) - - engine.run_code(file) - - args, _ = mock_run.call_args - - assert args[0][0] == "pdflatex" - - -# --------------------------------------------------------- -# 17. .py nutzt py Interpreter -# --------------------------------------------------------- - -@patch("subprocess.run") -def test_python_uses_py_interpreter(mock_run, engine, tmp_path): +def test_python_uses_sys_executable(mock_run, engine, tmp_path): file = tmp_path / "main.py" file.write_text("print(1)") @@ -368,7 +328,7 @@ def test_python_uses_py_interpreter(mock_run, engine, tmp_path): args, _ = mock_run.call_args - assert args[0][0] == "py" + assert args[0][0] == sys.executable # ---------------------------------------------------------