From 73328303d4e2e00e9b778cf67528ad8639344483 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 14 Dec 2018 22:33:11 +0000 Subject: [PATCH] Start worker using subprocess This is because it ends up forking the tests else, which is really weird, and bad --- tests/__init__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index c0d62af..bea9230 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,5 +1,7 @@ import functools import os +import shutil +import subprocess from aiohttp.test_utils import unused_port from aiounittest import AsyncTestCase @@ -28,10 +30,12 @@ class BaseWorkerTestCase(BaseTestCase): def setUp(self): super().setUp() self.unused_port = unused_port() - result = self.run_cli(["start", "--port", self.unused_port]) - self.assertEqual(result.exit_code, 0, result.stdout) + result = subprocess.run( + [shutil.which("ctf"), "start", "--port", str(self.unused_port)] + ) + self.assertEqual(result.returncode, 0) def tearDown(self): - result = self.run_cli(["stop"]) - self.assertEqual(result.exit_code, 0, result.stdout) + result = subprocess.run([shutil.which("ctf"), "stop"]) + self.assertEqual(result.returncode, 0) super().tearDown()