diff --git a/tests/test_core.py b/tests/test_core.py index 959bb5f..d3f5db4 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -10,17 +10,19 @@ except: class TestCore(unittest.TestCase): - def setUp(self): + @classmethod + def setUpClass(cls): system = platform.system() if system == 'Windows': - self.target = subprocess.Popen([r"C:\Windows\notepad.exe"]) + cls.target = subprocess.Popen([r"C:\Windows\notepad.exe"]) else: - self.target = subprocess.Popen(["/bin/cat"]) - self.process = frida.attach(self.target.pid) + cls.target = subprocess.Popen(["/bin/cat"]) + cls.process = frida.attach(cls.target.pid) - def tearDown(self): - self.process.detach() - self.target.terminate() + @classmethod + def tearDownClass(cls): + cls.process.detach() + cls.target.terminate() def test_enumerate_devices(self): devices = frida.get_device_manager().enumerate_devices() diff --git a/tests/test_discoverer.py b/tests/test_discoverer.py index 0e68386..a38e223 100644 --- a/tests/test_discoverer.py +++ b/tests/test_discoverer.py @@ -11,17 +11,19 @@ except: class TestDiscoverer(unittest.TestCase): - def setUp(self): + @classmethod + def setUpClass(cls): system = platform.system() if system == 'Windows': - self.target = subprocess.Popen([r"C:\Windows\notepad.exe"]) + cls.target = subprocess.Popen([r"C:\Windows\notepad.exe"]) else: - self.target = subprocess.Popen(["/bin/cat"]) - self.process = frida.attach(self.target.pid) + cls.target = subprocess.Popen(["/bin/cat"]) + cls.process = frida.attach(cls.target.pid) - def tearDown(self): - self.process.detach() - self.target.terminate() + @classmethod + def tearDownClass(cls): + cls.process.detach() + cls.target.terminate() def test_basics(self): test_ui = TestUI() diff --git a/tests/test_tracer.py b/tests/test_tracer.py index 4f181ba..6c85b05 100644 --- a/tests/test_tracer.py +++ b/tests/test_tracer.py @@ -9,17 +9,19 @@ except: class TestTracer(unittest.TestCase): - def setUp(self): + @classmethod + def setUpClass(cls): system = platform.system() if system == 'Windows': - self.target = subprocess.Popen([r"C:\Windows\notepad.exe"]) + cls.target = subprocess.Popen([r"C:\Windows\notepad.exe"]) else: - self.target = subprocess.Popen(["/bin/cat"]) - self.process = frida.attach(self.target.pid) + cls.target = subprocess.Popen(["/bin/cat"]) + cls.process = frida.attach(cls.target.pid) - def tearDown(self): - self.process.detach() - self.target.terminate() + @classmethod + def tearDownClass(cls): + cls.process.detach() + cls.target.terminate() def test_basics(self): tp = TracerProfileBuilder().include("open*")