Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitab182c2

Browse files
committed
fix(display): ignore xvfb shutdown timeout errors
1 parent56d6cbf commitab182c2

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

‎src/ffpuppet/display.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
fromloggingimportgetLogger
1010
fromosimportenviron
1111
fromplatformimportsystem
12+
fromsubprocessimportTimeoutExpired
1213
fromtypesimportMappingProxyType
1314
fromtypingimportTYPE_CHECKING
1415

@@ -93,7 +94,11 @@ def __init__(self) -> None:
9394

9495
defclose(self)->None:
9596
ifself._xvfbisnotNone:
96-
self._xvfb.stop()
97+
try:
98+
self._xvfb.stop()
99+
exceptTimeoutExpired:
100+
ifself._xvfb.procisnotNone:
101+
self._xvfb.proc.kill()
97102
self._xvfb=None
98103

99104

‎src/ffpuppet/test_display.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"""display.py tests"""
55

66
fromplatformimportsystem
7+
fromsubprocessimportTimeoutExpired
78

89
frompytestimportmark,raises
910

@@ -55,4 +56,15 @@ def test_xvfb_resolution(mocker, resolution, expected_width, expected_height):
5556
{}ifresolutionisNoneelse {"XVFB_RESOLUTION":resolution},
5657
)
5758
XvfbDisplay()
59+
assertxvfb.return_value.start.call_count==1
5860
xvfb.assert_called_with(width=expected_width,height=expected_height,timeout=60)
61+
62+
63+
@mark.skipif(system()!="Linux",reason="Only supported on Linux")
64+
deftest_xvfb_stop_hang(mocker):
65+
"""test XvfbDisplay.stop hang"""
66+
xvfb=mocker.patch("ffpuppet.display.Xvfb")
67+
xvfb.return_value.stop.side_effect=TimeoutExpired(["foo"],1)
68+
display=XvfbDisplay()
69+
display.close()
70+
assertxvfb.return_value.proc.kill.call_count==1

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp