more testing

This commit is contained in:
meejah 2022-09-15 20:06:32 -06:00
parent cad162bb8f
commit 0e0ebf6687

View File

@ -20,6 +20,9 @@ from testtools import (
skipIf,
)
from hypothesis.strategies import text
from hypothesis import given
from testtools.matchers import (
Contains,
Equals,
@ -44,6 +47,10 @@ from ...scripts.tahoe_run import (
RunOptions,
run,
)
from ...util.pid import (
check_pid_process,
InvalidPidFile,
)
from ...scripts.runner import (
parse_options
@ -180,7 +187,18 @@ class RunTests(SyncTestCase):
config.stderr.getvalue(),
Contains("found invalid PID file in"),
)
# because the pidfile is invalid we shouldn't get to the
# .run() call itself.
self.assertThat(
DummyRunner.runs,
Equals([])
)
@given(text())
def test_pidfile_contents(self, content):
pidfile = FilePath("pidfile")
pidfile.setContent(content.encode("utf8"))
with self.assertRaises(InvalidPidFile):
with check_pid_process(pidfile):
pass