From c7a4e3b38f7806b2046a8c720b4e50c58317a604 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 4 Dec 2025 11:32:53 +0000 Subject: [PATCH 1/2] Initial plan From f20381c54da92454ce518af2303f55758ab843bc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 4 Dec 2025 11:36:30 +0000 Subject: [PATCH 2/2] Refactor: Move subprocess and os imports to top of file (AGENTS.md) Co-authored-by: micaelarp <50937937+micaelarp@users.noreply.github.com> --- python/christmas_lights_kata/tests/test_controller.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/python/christmas_lights_kata/tests/test_controller.py b/python/christmas_lights_kata/tests/test_controller.py index ff7de67..ee15776 100644 --- a/python/christmas_lights_kata/tests/test_controller.py +++ b/python/christmas_lights_kata/tests/test_controller.py @@ -1,5 +1,9 @@ +import os +import subprocess import sys + import pytest + from python.christmas_lights_kata.src import controller @@ -22,8 +26,6 @@ def test_main_runs_and_reports_lit_lights(tmp_path, capsys): def test_main_with_invalid_instruction(tmp_path): """Should print error and exit for invalid instructions (robust subprocess test).""" - import subprocess - import os instr = "invalid command" instr_path = tmp_path / "instr.md" instr_path.write_text(instr) @@ -43,7 +45,6 @@ def test_main_with_empty_file(tmp_path): """Should report zero lights lit for empty instruction file.""" instr_path = tmp_path / "instr.md" instr_path.write_text("") - import subprocess, os env = os.environ.copy() env["PYTHONPATH"] = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../..")) result = subprocess.run([ @@ -60,7 +61,6 @@ def test_main_with_only_comments(tmp_path): """Should report zero lights lit for file with only comments.""" instr_path = tmp_path / "instr.md" instr_path.write_text("# comment\n# another comment") - import subprocess, os env = os.environ.copy() env["PYTHONPATH"] = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../..")) result = subprocess.run([ @@ -78,7 +78,6 @@ def test_main_with_extra_spaces(tmp_path): instr = " turn on 0,0 through 0,0 " instr_path = tmp_path / "instr.md" instr_path.write_text(instr) - import subprocess, os env = os.environ.copy() env["PYTHONPATH"] = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../..")) result = subprocess.run([ @@ -96,7 +95,6 @@ def test_main_with_out_of_bounds(tmp_path): instr = "turn on -1,0 through 0,0" instr_path = tmp_path / "instr.md" instr_path.write_text(instr) - import subprocess, os env = os.environ.copy() env["PYTHONPATH"] = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../..")) result = subprocess.run([