|
22 | 22 |
|
23 | 23 |
|
24 | 24 | class CommunicatorSpawner:
|
25 |
| - def __init__(self, tmpdir): |
26 |
| - self.tmpdir = tmpdir |
| 25 | + def __init__(self, tmp_path): |
| 26 | + self.tmp_path = tmp_path |
27 | 27 |
|
28 | 28 | def spawn_writer(self, message: str, repeats: int = 1, interval=None):
|
29 | 29 | length = len(message) * repeats
|
30 |
| - commands_file = self.tmpdir / "writer.py" |
| 30 | + commands_file = self.tmp_path / "writer.py" |
31 | 31 | commands_file.write(
|
32 | 32 | WRITER_TEMPLATE.format(
|
33 | 33 | length=length, repeats=repeats, interval=interval or 0, message=message
|
34 | 34 | )
|
35 | 35 | )
|
36 | 36 | return subprocess.Popen(
|
37 |
| - ["python", "-u", commands_file.realpath()], |
| 37 | + ["python", "-u", str(commands_file)], |
38 | 38 | stdin=subprocess.PIPE,
|
39 | 39 | stdout=subprocess.PIPE,
|
40 | 40 | )
|
41 | 41 |
|
42 | 42 |
|
43 | 43 | @pytest.fixture
|
44 |
| -def communicator_spawner(tmpdir): |
45 |
| - return CommunicatorSpawner(tmpdir) |
| 44 | +def communicator_spawner(tmp_path): |
| 45 | + return CommunicatorSpawner(tmp_path) |
46 | 46 |
|
47 | 47 |
|
48 | 48 | def communicate_and_close(process, wait=1):
|
@@ -72,7 +72,7 @@ async def test_reader(message, repeats, interval, communicator_spawner):
|
72 | 72 | message=message, repeats=repeats, interval=interval
|
73 | 73 | )
|
74 | 74 | reader = LspStdIoReader(stream=process.stdout, queue=queue)
|
75 |
| - timeout = 2 + (interval or 1) * repeats * 2 |
| 75 | + timeout = 2 + (interval or 1) * repeats * 10 |
76 | 76 |
|
77 | 77 | communicate_and_close(process)
|
78 | 78 | await asyncio.wait_for(reader.read(), timeout=timeout)
|
|
0 commit comments