Skip to content

Commit ee69a17

Browse files
authored
Try to fix tests on MacOS and Windows
1 parent 024a156 commit ee69a17

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

python_packages/jupyter_lsp/jupyter_lsp/tests/test_stdio.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,27 @@
2222

2323

2424
class CommunicatorSpawner:
25-
def __init__(self, tmpdir):
26-
self.tmpdir = tmpdir
25+
def __init__(self, tmp_path):
26+
self.tmp_path = tmp_path
2727

2828
def spawn_writer(self, message: str, repeats: int = 1, interval=None):
2929
length = len(message) * repeats
30-
commands_file = self.tmpdir / "writer.py"
30+
commands_file = self.tmp_path / "writer.py"
3131
commands_file.write(
3232
WRITER_TEMPLATE.format(
3333
length=length, repeats=repeats, interval=interval or 0, message=message
3434
)
3535
)
3636
return subprocess.Popen(
37-
["python", "-u", commands_file.realpath()],
37+
["python", "-u", str(commands_file)],
3838
stdin=subprocess.PIPE,
3939
stdout=subprocess.PIPE,
4040
)
4141

4242

4343
@pytest.fixture
44-
def communicator_spawner(tmpdir):
45-
return CommunicatorSpawner(tmpdir)
44+
def communicator_spawner(tmp_path):
45+
return CommunicatorSpawner(tmp_path)
4646

4747

4848
def communicate_and_close(process, wait=1):
@@ -72,7 +72,7 @@ async def test_reader(message, repeats, interval, communicator_spawner):
7272
message=message, repeats=repeats, interval=interval
7373
)
7474
reader = LspStdIoReader(stream=process.stdout, queue=queue)
75-
timeout = 2 + (interval or 1) * repeats * 2
75+
timeout = 2 + (interval or 1) * repeats * 10
7676

7777
communicate_and_close(process)
7878
await asyncio.wait_for(reader.read(), timeout=timeout)

0 commit comments

Comments
 (0)