import hashlib import json import re import subprocess import tempfile import unittest import xml.etree.ElementTree as ET from pathlib import Path from unittest.mock import patch from tools import codex_harness from tools import prod2u_p4_harness from tools import prod2u_p4_normal_v3_build ROOT = Path(__file__).resolve().parents[2] PROJECT = ROOT / "projects" / "prod2u-door-temp" / "project.json" CONVERGENCE_RUN_ID = "b2a3230e66f74a35bb74ac6730e58bb5" CONVERGENCE_BRANCH = codex_harness._run_git(ROOT, ["branch", "--show-current"]).stdout.decode("ascii").strip() ASSIGNED_BASE_COMMIT = codex_harness._run_git(ROOT, ["rev-parse", "HEAD"]).stdout.decode("ascii").strip() OWNED_TEST_PATHS = [ "tests/unit/test_project_config.py", "tests/unit/test_phase1_contract.py", "tests/unit/test_codex_harness.py", "tests/unit/test_native_multi_agent_contract.py", "tests/unit/test_project_generation.py", "config/prod2u_p4_verification_targets_v1.json", ] def _current_full_commit() -> str: return codex_harness._run_git(ROOT, ["rev-parse", "HEAD"]).stdout.decode("ascii").strip() def _current_short_commit() -> str: return codex_harness.current_commit8(ROOT) def _report_base( *, run_id: str = CONVERGENCE_RUN_ID, task_id: str = "audit", assigned_base_commit: str = ASSIGNED_BASE_COMMIT, ) -> dict: return { "schema": codex_harness.AGENT_TASK_REPORT_SCHEMA, "run_id": run_id, "task_id": task_id, "dependencies": [], "assigned_base_commit": assigned_base_commit, "result_commit": None, "integration_commit": None, "feature_branch": CONVERGENCE_BRANCH, "worktree": str(ROOT), "owned_paths": list(OWNED_TEST_PATHS), "native_thread": { "model_policy": "unconstrained", "reasoning_effort_policy": "unconstrained", "observed_model": None, "observed_reasoning_effort": None, "model_selection_source": "not_exposed", "effort_selection_source": "not_exposed", "observation_source": "not_exposed", "observed_permission_mode": "not_exposed", }, "status": "completed", "read_only_report": "read-only evidence", } class CodexHarnessTests(unittest.TestCase): def test_run_id_is_lowercase_32_hex(self): value = codex_harness.new_run_id() self.assertRegex(value, r"^[0-9a-f]{32}$") def test_source_manifest_is_project_bound_and_excludes_legacy_protocol_sources(self): manifest = codex_harness.build_source_manifest(Path.cwd()) paths = manifest["sources"] self.assertIn("src/top/prod2u_p4_normal_v3_top.v", paths) self.assertIn("src/common/frame_rx.v", paths) self.assertNotIn("src/rtl/binary921_crc16.v", paths) self.assertNotIn("src/rtl/binary921_frame_tx.v", paths) self.assertEqual(manifest["project_id"], "prod2u-door-temp") self.assertRegex(manifest["project_sha256"], r"^[0-9a-f]{64}$") def test_unverified_package_binds_commit_project_and_bitstream_hash(self): with tempfile.TemporaryDirectory() as directory: root = Path(directory) bitstream = root / "candidate.bit" bitstream.write_bytes(b"candidate-bitstream") package = codex_harness.create_unverified_package( bitstream=bitstream, project=PROJECT, commit=_current_short_commit(), run_id="a" * 32, output_root=root / "dist", ) manifest = json.loads((package / "package_manifest.json").read_text(encoding="utf-8")) self.assertEqual(manifest["status"], "UNVERIFIED") self.assertEqual(manifest["commit"], _current_short_commit()) self.assertEqual(manifest["commit_full"], _current_full_commit()) self.assertEqual(manifest["run_id"], "a" * 32) self.assertEqual( manifest["bitstream_sha256"], hashlib.sha256(b"candidate-bitstream").hexdigest(), ) self.assertTrue((package / "fw.bit").is_file()) self.assertEqual(package.name, _current_short_commit() + "-" + manifest["bitstream_sha256"][:16]) package_info = json.loads((package / "package-info.json").read_text(encoding="utf-8")) self.assertEqual(package_info["schema"], "prod2u-p4-normal-v3-folder-package-info-v3") self.assertEqual(package_info["bitstream"], "fw.bit") self.assertEqual(package_info["bitstream_sha256"], manifest["bitstream_sha256"]) self.assertTrue((package / "protocol.md").is_file()) self.assertTrue((package / "requirements.zh-CN.md").is_file()) self.assertTrue((package / "source_manifest.json").is_file()) self.assertTrue((package / "verification_targets.json").is_file()) for relative in ( "evidence/td-primary-receipt.json", "evidence/td-confirmation-receipt.json", "evidence/python-unit-receipt.json", "evidence/icarus-receipt.json", "evidence/verilator-receipt.json", "evidence/cocotb-receipt.json", "evidence/formal-receipt.json", "evidence/validation-summary.json", ): self.assertTrue((package / relative).is_file(), relative) def test_final_candidate_package_preserves_unverified_offline_contract(self): with tempfile.TemporaryDirectory() as directory: root = Path(directory) bitstream = root / "candidate.bit" bitstream.write_bytes(b"final-candidate-bitstream") run_id = "d" * 32 package_class = "UNVERIFIED_FINAL_CANDIDATE" package = codex_harness.create_unverified_package( bitstream=bitstream, project=PROJECT, commit=_current_short_commit(), package_class=package_class, run_id=run_id, output_root=root / "dist", ) manifest = json.loads((package / "package_manifest.json").read_text(encoding="utf-8")) package_info = json.loads((package / "package-info.json").read_text(encoding="utf-8")) self.assertEqual(manifest["status"], "UNVERIFIED") for metadata in (manifest, package_info): self.assertEqual(metadata["package_class"], package_class) self.assertEqual(metadata["verification_scope"], "offline") self.assertEqual(metadata["hardware_validation"], "not_run") self.assertEqual(metadata["board_validation"], "not_run") self.assertEqual(metadata["programming_validation"], "not_run") self.assertFalse(metadata["COM"]) self.assertFalse(metadata["JTAG"]) receipt = prod2u_p4_harness.package_selftest_payload( package, verification_run_id=run_id ) self.assertNotIn("package_class_invalid", receipt["failures"]) def test_early_unverified_package_binds_full_production_and_input_receipt_hashes(self): with tempfile.TemporaryDirectory() as directory: root = Path(directory) bitstream = root / "candidate.bit" bitstream.write_bytes(b"early-candidate-bitstream") td_receipt = root / "td-primary.json" td_receipt.write_text( '{"schema":"td","status":"pass"}\n', encoding="utf-8" ) source_manifest = codex_harness.build_source_manifest() source_manifest_bytes = ( json.dumps(source_manifest, indent=2, sort_keys=True) + "\n" ).encode("utf-8") expected_source_manifest_sha256 = hashlib.sha256(source_manifest_bytes).hexdigest() expected_td_receipt_sha256 = hashlib.sha256(td_receipt.read_bytes()).hexdigest() production_commit = _current_full_commit() package = codex_harness.create_unverified_package( bitstream=bitstream, project=PROJECT, commit=_current_short_commit(), production_integration_commit=production_commit, source_manifest_sha256=expected_source_manifest_sha256, td_receipt_sha256=expected_td_receipt_sha256, package_class="UNVERIFIED_EARLY_BUILD", run_id="9" * 32, output_root=root / "dist", td_receipt=td_receipt, ) manifest = json.loads((package / "package_manifest.json").read_text(encoding="utf-8")) package_info = json.loads((package / "package-info.json").read_text(encoding="utf-8")) bound_td = package / "evidence" / "td-primary-receipt.json" bound_td_value = json.loads(bound_td.read_text(encoding="utf-8")) self.assertEqual(manifest["status"], "UNVERIFIED") self.assertEqual(manifest["package_class"], "UNVERIFIED_EARLY_BUILD") self.assertEqual(manifest["commit"], _current_short_commit()) self.assertEqual(manifest["commit_full"], _current_full_commit()) self.assertEqual(manifest["production_integration_commit"], production_commit) self.assertEqual(manifest["source_manifest_sha256"], expected_source_manifest_sha256) self.assertEqual(manifest["bitstream_sha256"], hashlib.sha256(bitstream.read_bytes()).hexdigest()) self.assertEqual( bound_td_value["source_receipt_sha256"], expected_td_receipt_sha256 ) self.assertEqual( manifest["td_receipt_sha256"], hashlib.sha256(bound_td.read_bytes()).hexdigest() ) self.assertEqual(package_info["production_integration_commit"], production_commit) self.assertEqual(package_info["source_manifest_sha256"], expected_source_manifest_sha256) self.assertEqual(package_info["package_class"], "UNVERIFIED_EARLY_BUILD") def test_early_unverified_package_rejects_mismatched_binding_hashes(self): with tempfile.TemporaryDirectory() as directory: root = Path(directory) bitstream = root / "candidate.bit" bitstream.write_bytes(b"early-candidate-bitstream") td_receipt = root / "td-primary.json" td_receipt.write_text( '{"schema":"td","status":"pass"}\n', encoding="utf-8" ) kwargs = { "bitstream": bitstream, "project": PROJECT, "commit": _current_short_commit(), "production_integration_commit": "b" * 40, "source_manifest_sha256": "c" * 64, "td_receipt_sha256": "d" * 64, "package_class": "UNVERIFIED_EARLY_BUILD", "run_id": "a" * 32, "output_root": root / "dist", "td_receipt": td_receipt, } with self.assertRaisesRegex(ValueError, "source manifest"): codex_harness.create_unverified_package(**kwargs) def test_early_package_selftest_accepts_and_detects_production_binding_tamper(self): with tempfile.TemporaryDirectory() as directory: root = Path(directory) bitstream = root / "candidate.bit" bitstream.write_bytes(b"early-selftest-bitstream") td_receipt = root / "td-primary.json" td_receipt.write_text( '{"schema":"td","status":"pass"}\n', encoding="utf-8" ) source_manifest = codex_harness.build_source_manifest() expected_source_manifest_sha256 = hashlib.sha256( (json.dumps(source_manifest, indent=2, sort_keys=True) + "\n").encode( "utf-8" ) ).hexdigest() expected_td_receipt_sha256 = hashlib.sha256(td_receipt.read_bytes()).hexdigest() run_id = "8" * 32 production_commit = _current_full_commit() package = codex_harness.create_unverified_package( bitstream=bitstream, project=PROJECT, commit=_current_short_commit(), production_integration_commit=production_commit, source_manifest_sha256=expected_source_manifest_sha256, td_receipt_sha256=expected_td_receipt_sha256, package_class="UNVERIFIED_EARLY_BUILD", run_id=run_id, output_root=root / "dist", td_receipt=td_receipt, ) valid = prod2u_p4_harness.package_selftest_payload( package, verification_run_id=run_id ) self.assertEqual(valid["status"], "fail") self.assertTrue(valid["failures"]) package_info_path = package / "package-info.json" package_info = json.loads(package_info_path.read_text(encoding="utf-8")) package_info["production_integration_commit"] = "f" * 40 package_info_path.write_text( json.dumps(package_info, indent=2, sort_keys=True) + "\n", encoding="utf-8", newline="\n", ) tampered = prod2u_p4_harness.package_selftest_payload( package, verification_run_id=run_id ) self.assertEqual(tampered["status"], "fail") self.assertTrue(tampered["failures"]) self.assertIn( "early_manifest_commit_mismatch", " ".join(tampered["failures"]), ) def test_unverified_package_matches_prod2u_selftest_contract(self): with tempfile.TemporaryDirectory() as directory: root = Path(directory) bitstream = root / "candidate.bit" bitstream.write_bytes(b"candidate-bitstream") package = codex_harness.create_unverified_package( bitstream=bitstream, project=PROJECT, commit=_current_short_commit(), run_id="b" * 32, output_root=root / "dist", ) receipt = prod2u_p4_harness.package_selftest_payload( package, verification_run_id="b" * 32, ) self.assertEqual(receipt["status"], "fail") self.assertTrue(receipt["failures"]) def test_supplied_receipt_is_copied_with_package_bindings(self): with tempfile.TemporaryDirectory() as directory: root = Path(directory) bitstream = root / "candidate.bit" bitstream.write_bytes(b"candidate-bitstream") source_receipt = root / "icarus.json" source_receipt.write_text( json.dumps( { "schema": "hdl", "status": "pass", "command": "iverilog -o sim.vvp top_tb.v", "tool_version": "Icarus Verilog 12.0", } ) + "\n", encoding="utf-8", ) package = codex_harness.create_unverified_package( bitstream=bitstream, project=PROJECT, commit=_current_short_commit(), run_id="c" * 32, output_root=root / "dist", verification_receipts={"icarus": source_receipt}, ) bound = json.loads((package / "evidence/icarus-receipt.json").read_text(encoding="utf-8")) self.assertEqual(bound["status"], "pass") self.assertTrue(bound["authoritative"]) self.assertFalse(bound["placeholder"]) self.assertEqual(bound["verification_run_id"], "c" * 32) self.assertEqual(bound["commit"], _current_full_commit()) self.assertEqual(bound["commit_full"], _current_full_commit()) self.assertRegex(bound["project_config_sha256"], r"^[0-9a-f]{64}$") self.assertRegex(bound["source_receipt_sha256"], r"^[0-9a-f]{64}$") self.assertEqual(bound["command"], "iverilog -o sim.vvp top_tb.v") self.assertEqual(bound["tool_version"], "Icarus Verilog 12.0") def test_incomplete_supplied_receipt_is_blocked_not_authoritative(self): with tempfile.TemporaryDirectory() as directory: root = Path(directory) bitstream = root / "candidate.bit" bitstream.write_bytes(b"candidate-bitstream") source_receipt = root / "icarus.json" source_receipt.write_text('{"schema":"hdl","status":"pass"}\n', encoding="utf-8") package = codex_harness.create_unverified_package( bitstream=bitstream, project=PROJECT, commit=_current_short_commit(), run_id="c" * 32, output_root=root / "dist", verification_receipts={"icarus": source_receipt}, ) bound = json.loads((package / "evidence/icarus-receipt.json").read_text(encoding="utf-8")) self.assertEqual(bound["status"], "blocked") self.assertFalse(bound["authoritative"]) self.assertTrue(bound["placeholder"]) def test_build_source_list_and_build_info_use_only_the_new_contract(self): sources = prod2u_p4_normal_v3_build.PRODUCTION_RTL_SOURCES self.assertIn("src/common/frame_rx.v", sources) self.assertIn("src/modules/shared_500us_tick.v", sources) self.assertIn("src/modules/host_watchdog.v", sources) self.assertIn("src/top/prod2u_p4_normal_v3_top.v", sources) self.assertNotIn("src/rtl/binary921_crc16.v", sources) self.assertNotIn("src/rtl/prod2u_p4_normal_v3_watchdog.v", sources) with tempfile.TemporaryDirectory() as directory: bitstream = Path(directory) / "candidate.bit" bitstream.write_bytes(b"candidate") info = prod2u_p4_normal_v3_build.create_build_info( bitstream=bitstream, commit=_current_short_commit(), ) self.assertEqual(info["serial"], {"baud": 115200, "format": "8N1", "flow_control": "none"}) self.assertEqual( info["hardware_access"], {"com": False, "jtag": False, "programming": False, "drivers": False}, ) def test_source_closure_is_bidirectional_across_manifest_build_and_td_consumers(self): generated = json.loads( (ROOT / "src" / "generated" / "td-source-manifest.json").read_text(encoding="utf-8") ) canonical = generated["sources"] self.assertEqual(canonical, list(prod2u_p4_normal_v3_build.PRODUCTION_RTL_SOURCES)) self.assertEqual(canonical, codex_harness.build_source_manifest(ROOT)["sources"]) project = ET.parse(ROOT / "td" / "prod2u_p4_normal_v3.prj") td_project_sources = [ Path(node.attrib["Path"]).as_posix().removeprefix("../") for node in project.findall(".//Verilog/File") ] self.assertEqual(td_project_sources, canonical) syn = (ROOT / "td" / "syn" / "prod2u_p4_normal_v3.tcl").read_text(encoding="ascii") tcl_sources = [ Path(match).as_posix() for match in re.findall(r"analyze\s+-file\s+\{([^}]+)\}", syn) ] self.assertEqual(tcl_sources, canonical) self.assertEqual(len(canonical), len(set(canonical))) self.assertTrue(all((ROOT / source).is_file() for source in canonical)) def test_runtime_profile_is_the_new_115200_contract(self): self.assertEqual( prod2u_p4_harness.RUNTIME_PROFILE, "prod2u-door-temp-115200-v1", ) def test_qor_attribute_count_accepts_td_gate_qor_name(self): with tempfile.TemporaryDirectory() as directory: root = Path(directory) (root / "gate.qor").write_text( "| #async_reg | 6 |\n", encoding="ascii", ) observed = prod2u_p4_harness.parse_qor_attribute_count( root / "prod2u_p4_normal_v3_gate.qor", "async_reg", ) self.assertEqual(observed, 6) def test_verification_inventory_uses_only_the_current_manifest(self): manifest = prod2u_p4_harness.load_target_manifest() self.assertEqual( manifest["schema"], "prod2u-simple-verification-target-manifest-v1", ) self.assertEqual( [target["name"] for target in prod2u_p4_harness.cocotb_tests()], ["prod2u_door_temp_uart_e2e"], ) self.assertEqual( [target["name"] for target in prod2u_p4_harness.formal_targets()], [ "frame_command_contract", "frame_tx_contract", "output_target_ram_contract", "simple_frame_contract", "simple_motor_temperature_contract", "pwm_scheduler_contract", "host_watchdog_contract", "startup_close_seek", ], ) icarus_names = [target["name"] for target in prod2u_p4_harness.hdl_testbenches()] self.assertEqual( icarus_names, sorted(manifest["layers"]["icarus"]), ) def test_simple_motor_temperature_task_engines_match_formal_contract(self): path = ROOT / "tests" / "formal" / "simple_motor_temperature_contract.sby" self.assertEqual( prod2u_p4_harness.formal_task_engines(path, ["prove", "cover"]), {"prove": ["abc pdr"], "cover": ["smtbmc yices"]}, ) def test_agent_task_report_accepts_unconstrained_observations_and_full_commits(self): # A capability probe is a read-only report for the exact dispatch HEAD. # It must not reinterpret later production/formal commits as this task's # owned paths when the shared convergence branch has advanced. capability_head = _current_full_commit() report = _report_base( task_id="capability_probe", assigned_base_commit=capability_head ) report["result_commit"] = capability_head report["read_only_report"] = None report["owned_paths"] = ["tests/", "config/prod2u_p4_verification_targets_v1.json"] validated = codex_harness.validate_agent_task_report( report, expected_run_id=CONVERGENCE_RUN_ID, expected_base_commit=capability_head, root=ROOT, ) self.assertEqual(validated["assigned_base_commit"], capability_head) self.assertEqual(validated["feature_branch"], CONVERGENCE_BRANCH) self.assertEqual(validated["worktree"], str(ROOT)) def test_agent_task_report_accepts_read_only_report_with_unexposed_observations(self): report = _report_base(task_id="repo_process_audit") report["native_thread"]["observed_model"] = None report["native_thread"]["observed_reasoning_effort"] = None validated = codex_harness.validate_agent_task_report( report, expected_run_id=CONVERGENCE_RUN_ID, expected_base_commit=ASSIGNED_BASE_COMMIT, ) self.assertEqual(validated["read_only_report"], "read-only evidence") def test_agent_task_report_rejects_stale_assigned_base(self): report = _report_base(task_id="stale") report["assigned_base_commit"] = "0" * 40 with self.assertRaisesRegex(ValueError, "stale"): codex_harness.validate_agent_task_report( report, expected_run_id=CONVERGENCE_RUN_ID, expected_base_commit=ASSIGNED_BASE_COMMIT, ) def test_agent_task_report_rejects_dependency_mismatch_but_preserves_integration_conflict(self): report = _report_base(task_id="dependent") report["dependencies"] = [ {"task_id": "producer", "result_commit": "2" * 40, "integration_commit": None} ] report["status"] = "integration_conflict" report["read_only_report"] = "conflicting paths" with self.assertRaisesRegex(ValueError, "dependency"): codex_harness.validate_agent_task_report( report, expected_run_id=CONVERGENCE_RUN_ID, expected_base_commit=ASSIGNED_BASE_COMMIT, expected_dependencies={ "producer": {"result_commit": "3" * 40, "integration_commit": None} }, ) report["dependencies"][0]["result_commit"] = "3" * 40 validated = codex_harness.validate_agent_task_report( report, expected_run_id=CONVERGENCE_RUN_ID, expected_base_commit=ASSIGNED_BASE_COMMIT, expected_dependencies={ "producer": {"result_commit": "3" * 40, "integration_commit": None} }, ) self.assertEqual(validated["status"], "integration_conflict") def test_agent_task_report_rejects_duplicate_dependencies(self): report = _report_base(task_id="duplicate-dependency") report["dependencies"] = [ {"task_id": "producer", "result_commit": None, "integration_commit": None}, {"task_id": "producer", "result_commit": None, "integration_commit": None}, ] with self.assertRaisesRegex(ValueError, "duplicate dependency"): codex_harness.validate_agent_task_report( report, expected_run_id=CONVERGENCE_RUN_ID, expected_base_commit=ASSIGNED_BASE_COMMIT, ) def test_worktree_identity_rejects_protected_root_wrong_branch_and_wrong_head(self): with self.assertRaisesRegex(ValueError, "protected_worktree_violation"): codex_harness.validate_worktree_identity(ROOT, protected_root=ROOT) with self.assertRaisesRegex(ValueError, "branch"): codex_harness.validate_worktree_identity( ROOT, expected_branch=CONVERGENCE_BRANCH + "-wrong" ) with self.assertRaisesRegex(ValueError, "HEAD"): codex_harness.validate_worktree_identity(ROOT, expected_head="0" * 40) def test_agent_task_report_rejects_non_worktree_report_cwd(self): report = _report_base(task_id="wrong-cwd") report["worktree"] = str(ROOT / "tools") with self.assertRaisesRegex(ValueError, "worktree root mismatch"): codex_harness.validate_agent_task_report( report, expected_run_id=CONVERGENCE_RUN_ID, expected_base_commit=ASSIGNED_BASE_COMMIT, ) def test_package_rejects_noncanonical_project_input(self): with tempfile.TemporaryDirectory() as directory: root = Path(directory) bitstream = root / "candidate.bit" bitstream.write_bytes(b"candidate-bitstream") fake_project = root / "project.json" fake_project.write_text('{"project_id":"prod2u-door-temp"}\n', encoding="utf-8") with self.assertRaisesRegex(ValueError, "canonical project"): codex_harness.create_unverified_package( bitstream=bitstream, project=fake_project, commit=_current_short_commit(), run_id=CONVERGENCE_RUN_ID, output_root=root / "dist", ) def test_name_status_z_parses_rename_and_copy_paths(self): events = codex_harness.parse_name_status_z( b"R100\0old.txt\0new.txt\0C100\0source.txt\0copy.txt\0M\0owned.txt\0" ) self.assertEqual( events, [ ("R100", ("old.txt", "new.txt")), ("C100", ("source.txt", "copy.txt")), ("M", ("owned.txt",)), ], ) def test_owned_paths_require_exact_files_or_explicit_directory_prefixes(self): events = [("R100", ("tests/unit/old.py", "tests/unit/new.py"))] self.assertEqual( codex_harness.validate_changed_paths(events, ["tests/unit/"]), ["tests/unit/old.py", "tests/unit/new.py"], ) with self.assertRaisesRegex(ValueError, "owned"): codex_harness.validate_changed_paths(events, ["tests/unit/old.py"]) with self.assertRaisesRegex(ValueError, "path"): codex_harness.validate_changed_paths([("M", ("../outside.py",))], ["tests/"]) with self.assertRaisesRegex(ValueError, "glob"): codex_harness.validate_changed_paths(events, ["tests/*.py"]) def test_agent_receipt_aggregation_preserves_hashes_and_bindings(self): aggregate = codex_harness.aggregate_agent_receipt_bindings( { "unit": { "verification_run_id": "a" * 32, "commit": "b" * 40, "artifact_sha256": "c" * 64, } }, expected_run_id="a" * 32, expected_commit="b" * 40, ) self.assertEqual(aggregate["receipts"]["unit"]["artifact_sha256"], "c" * 64) def test_current_commit8_uses_the_git_wrapper(self): completed = subprocess.CompletedProcess( args=["git"], returncode=0, stdout=b"0123abcd\n", stderr=b"" ) with patch.object(codex_harness.subprocess, "run", return_value=completed) as run: self.assertEqual(codex_harness.current_commit8(Path.cwd()), "0123abcd") args, kwargs = run.call_args self.assertEqual(args[0][0], "git") self.assertFalse(kwargs["shell"]) self.assertFalse(kwargs["text"]) self.assertIn("timeout", kwargs) if __name__ == "__main__": unittest.main()