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:
parent
ea7f195d0a
commit
73328303d4
1 changed files with 8 additions and 4 deletions
|
@ -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()
|
||||||
|
|
Reference in a new issue