Start worker using subprocess

This is because it ends up forking the tests else, which is really weird, and bad
This commit is contained in:
Jake Howard 2018-12-14 22:33:11 +00:00
parent ea7f195d0a
commit 73328303d4
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -1,5 +1,7 @@
import functools import functools
import os import os
import shutil
import subprocess
from aiohttp.test_utils import unused_port from aiohttp.test_utils import unused_port
from aiounittest import AsyncTestCase from aiounittest import AsyncTestCase
@ -28,10 +30,12 @@ class BaseWorkerTestCase(BaseTestCase):
def setUp(self): def setUp(self):
super().setUp() super().setUp()
self.unused_port = unused_port() self.unused_port = unused_port()
result = self.run_cli(["start", "--port", self.unused_port]) result = subprocess.run(
self.assertEqual(result.exit_code, 0, result.stdout) [shutil.which("ctf"), "start", "--port", str(self.unused_port)]
)
self.assertEqual(result.returncode, 0)
def tearDown(self): def tearDown(self):
result = self.run_cli(["stop"]) result = subprocess.run([shutil.which("ctf"), "stop"])
self.assertEqual(result.exit_code, 0, result.stdout) self.assertEqual(result.returncode, 0)
super().tearDown() super().tearDown()