From 9a430bdf6182dd04746f11024ebfdc4b4ad0704c Mon Sep 17 00:00:00 2001 From: Brian Kohan Date: Mon, 25 Dec 2023 22:54:48 -0800 Subject: [PATCH] fix v5 tests --- django_typer/tests/tests.py | 14 +++++++------- django_typer/types.py | 4 +++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/django_typer/tests/tests.py b/django_typer/tests/tests.py index 2ff2d22..370c962 100644 --- a/django_typer/tests/tests.py +++ b/django_typer/tests/tests.py @@ -78,7 +78,7 @@ def test_call_command_stdout(self): def test_get_version(self): self.assertEqual( - run_command("basic", "--version").strip(), django.get_version() + str(run_command("basic", "--version")).strip(), django.get_version() ) def test_call_direct(self): @@ -183,16 +183,16 @@ def test_call_command_stdout(self): def test_get_version(self): self.assertEqual( - run_command("multi", "--version").strip(), django.get_version() + str(run_command("multi", "--version")).strip(), django.get_version() ) self.assertEqual( - run_command("multi", "cmd1", "--version").strip(), django.get_version() + str(run_command("multi", "cmd1", "--version")).strip(), django.get_version() ) self.assertEqual( - run_command("multi", "sum", "--version").strip(), django.get_version() + str(run_command("multi", "sum", "--version")).strip(), django.get_version() ) self.assertEqual( - run_command("multi", "cmd3", "--version").strip(), django.get_version() + str(run_command("multi", "cmd3", "--version")).strip(), django.get_version() ) def test_call_direct(self): @@ -439,10 +439,10 @@ def test_call_command_stdout(self): def test_get_version(self): self.assertEqual( - run_command(self.cmd_name, "--version").strip(), django.get_version() + str(run_command(self.cmd_name, "--version")).strip(), django.get_version() ) self.assertEqual( - run_command(self.cmd_name, "6", self.cmd_name, "--version").strip(), + str(run_command(self.cmd_name, "6", self.cmd_name, "--version")).strip(), django.get_version(), ) diff --git a/django_typer/types.py b/django_typer/types.py index 232a538..c11427f 100644 --- a/django_typer/types.py +++ b/django_typer/types.py @@ -17,7 +17,9 @@ def print_version(context, _, value): command when --version is specified. """ if value: - echo(context.django_command.get_version()) + context.django_command.stdout.write( + context.django_command.get_version() + ) sys.exit()