From 57fa261f906588b44051eb9226d6fd0d0ab260b1 Mon Sep 17 00:00:00 2001 From: yrriban Date: Mon, 1 Dec 2025 02:35:49 -0500 Subject: [PATCH 1/2] Use input builtin to ask for the map name. --- dcc/text.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dcc/text.py b/dcc/text.py index 3e36310..3a816f7 100644 --- a/dcc/text.py +++ b/dcc/text.py @@ -71,7 +71,7 @@ class Text(dcc.doom_base.WadMap): if map_names is not None: text = map_names.get(f"map{parsed_args.map}") if text is None: - text = sys.stdin.read().rstrip() + text = input("Map Name? ") if not parsed_args.nomap: text = "MAP{}: {}".format(parsed_args.map, text) text = "{}\n{}".format(text, parsed_args.demotype) From 47133bdff738a4ddd7aae00a08c6a0729bea9df7 Mon Sep 17 00:00:00 2001 From: yrriban Date: Mon, 1 Dec 2025 02:42:10 -0500 Subject: [PATCH 2/2] Add a test for the play command. --- tests/play_test.py | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 tests/play_test.py diff --git a/tests/play_test.py b/tests/play_test.py new file mode 100644 index 0000000..4dbaa31 --- /dev/null +++ b/tests/play_test.py @@ -0,0 +1,52 @@ +import cliff.app +import dcc.play +import logging +import mockito.matchers +import pathlib +import subprocess +import tempfile + + +logger = logging.getLogger(__name__) + + +def test_play(when): + with tempfile.TemporaryDirectory() as td: + tdp = pathlib.Path(td) + tdp.joinpath("config.toml").write_text( + """ + dsda = "dsda-doom/exe" + iwad = "DOOM2.WAD" + complevel = "2" +""" + ) + pwp = tdp.joinpath("pwads") + pwp.mkdir() + scp = pwp.joinpath("scythe") + scp.mkdir() + scp.joinpath("config.toml").touch() + scp.joinpath("scythe.wad").touch() + zero = subprocess.CompletedProcess + zero.returncode = 0 + when(subprocess).run( + [ + tdp.joinpath("dsda-doom").joinpath("exe"), + "-iwad", + tdp.joinpath("iwads").joinpath("DOOM2.WAD"), + "-file", + tdp.joinpath("pwads").joinpath("scythe").joinpath("scythe.wad"), + "-complevel", + "2", + "-skill", + "4", + "-warp", + "01", + ] + ).thenReturn(zero) + dcc.play.Play.__init__ = lambda self: None + dcc.play.Play.get_epilog = lambda self: "" + rig = dcc.play.Play() + rig._hooks = [] + parser = rig.get_parser("test_play") + parsed_args = parser.parse_args(args=["--doom", td, "scythe", "01"]) + assert rig.run(parsed_args) == 0