From 54a5a3262f7ab3bf1f1ecba3cf95fcaa504f3243 Mon Sep 17 00:00:00 2001 From: ValekoZ Date: Sun, 2 Jun 2024 23:25:21 +0200 Subject: [PATCH] Clean tests --- tests/commands/arch.py | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/tests/commands/arch.py b/tests/commands/arch.py index 2b727dd83..9fb31acc8 100644 --- a/tests/commands/arch.py +++ b/tests/commands/arch.py @@ -2,24 +2,22 @@ Arch commands test module """ +import pytest + from tests.base import RemoteGefUnitTestGeneric from tests.utils import ARCH -import pytest class ArchCommand(RemoteGefUnitTestGeneric): - """Generic class for command testing, that defines all helpers""" - - def setUp(self) -> None: - return super().setUp() + """Class for `arch` command testing.""" @pytest.mark.skipif(ARCH != "x86_64", reason=f"Skipped for {ARCH}") def test_cmd_arch_get(self): gdb = self._gdb res = gdb.execute("arch get", to_string=True) - self.assertIn(" Architecture(X86, 64, LITTLE_ENDIAN)", res) - self.assertIn(" The architecture has been detected via the ELF headers", res) + assert " Architecture(X86, 64, LITTLE_ENDIAN)" in res + assert " The architecture has been detected via the ELF headers" in res def test_cmd_arch_set(self): gdb = self._gdb @@ -27,21 +25,21 @@ def test_cmd_arch_set(self): gdb.execute("arch set X86") res = gdb.execute("arch get", to_string=True) - self.assertIn(" Architecture(X86, 32, LITTLE_ENDIAN)", res) - self.assertIn(" The architecture has been set manually", res) + assert " Architecture(X86, 32, LITTLE_ENDIAN)" in res + assert " The architecture has been set manually" in res gdb.execute("arch set ppc") res = gdb.execute("arch get", to_string=True) - self.assertIn(" Architecture(PPC, PPC32, LITTLE_ENDIAN)", res) - self.assertIn(" The architecture has been set manually", res) + assert " Architecture(PPC, PPC32, LITTLE_ENDIAN)" in res + assert " The architecture has been set manually" in res def test_cmd_arch_list(self): gdb = self._gdb res = gdb.execute("arch list", to_string=True) - self.assertNotIn("- GenericArchitecture", res) - self.assertIn(" Architecture(X86, 64, LITTLE_ENDIAN)", res) - self.assertIn(" X86", res) - self.assertIn(" X86_64", res) + assert "- GenericArchitecture" not in res + assert " Architecture(X86, 64, LITTLE_ENDIAN)" in res + assert " X86" in res + assert " X86_64" in res