xvfbwrapper 0.2.22__tar.gz → 0.2.24__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xvfbwrapper
3
- Version: 0.2.22
3
+ Version: 0.2.24
4
4
  Summary: Manage headless displays with Xvfb (X virtual framebuffer)
5
5
  Author: Corey Goldberg
6
6
  Maintainer: Corey Goldberg
@@ -48,11 +48,40 @@ Dynamic: license-file
48
48
 
49
49
  ## Status
50
50
 
51
- | Type | Status |
52
- | ---- | ------ |
53
- | Build/Tests (CI) | [![Build/Tests (GitHub)](https://github.com/cgoldberg/xvfbwrapper/actions/workflows/test.yml/badge.svg)](https://github.com/cgoldberg/xvfbwrapper/actions/workflows/test.yml) |
54
- | Supported Python Versions | [![Supported Python Versions](https://img.shields.io/pypi/pyversions/xvfbwrapper)](https://pypi.org/project/xvfbwrapper) |
55
- | OSS Sponsorship | [![Tidelift](https://tidelift.com/badges/package/maven/com.fasterxml.uuid:java-uuid-generator)](https://tidelift.com/lifter/search/pypi/xvfbwrapper) |
51
+ <table>
52
+ <tr>
53
+ <td>Latest Version</td>
54
+ <td>
55
+ <a href="https://pypi.org/project/xvfbwrapper">
56
+ <img src="https://img.shields.io/pypi/v/xvfbwrapper.svg">
57
+ </a>
58
+ </td>
59
+ </tr>
60
+ <tr>
61
+ <td>Build/Tests (CI)</td>
62
+ <td>
63
+ <a href="https://github.com/cgoldberg/xvfbwrapper/actions/workflows/test.yml">
64
+ <img src="https://github.com/cgoldberg/xvfbwrapper/actions/workflows/test.yml/badge.svg">
65
+ </a>
66
+ </td>
67
+ </tr>
68
+ <tr>
69
+ <td>Supported Python Versions</td>
70
+ <td>
71
+ <a href="https://pypi.org/project/xvfbwrapper">
72
+ <img src="https://img.shields.io/pypi/pyversions/xvfbwrapper">
73
+ </a>
74
+ </td>
75
+ </tr>
76
+ <tr>
77
+ <td>OSS Sponsorship</td>
78
+ <td>
79
+ <a href="https://tidelift.com/lifter/search/pypi/xvfbwrapper">
80
+ <img src="https://tidelift.com/badges/package/pypi/xvfbwrapper">
81
+ </a>
82
+ </td>
83
+ </tr>
84
+ </table>
56
85
 
57
86
  ----
58
87
 
@@ -231,7 +260,7 @@ os.environ["XDG_SESSION_TYPE"] = "x11"
231
260
  class TestPage(unittest.TestCase):
232
261
 
233
262
  def setUp(self):
234
- xvfb = Xvfb()
263
+ xvfb = Xvfb(set_xdg_session_type=True)
235
264
  xvfb.start()
236
265
  self.driver = webdriver.Chrome()
237
266
  self.addCleanup(xvfb.stop)
@@ -253,26 +282,11 @@ if __name__ == "__main__":
253
282
 
254
283
  ----
255
284
 
256
- ## xvfbwrapper Issues
285
+ ## Development
257
286
 
258
- To report a bug or request a new feature, please open an issue on [GitHub][github-issues].
287
+ - Git: [github.com/cgoldberg/xvfbwrapper.git][github-repo]
259
288
 
260
- ----
261
-
262
- ## xvfbwrapper Development
263
-
264
- 1. Fork the project repo on [GitHub][github-repo]
265
-
266
- 2. Clone the repo:
267
-
268
- ```
269
- git clone https://github.com/<USERNAME>/xvfbwrapper.git
270
- cd xvfbwrapper
271
- ```
272
-
273
- 3. Make changes and run the tests:
274
-
275
- Create a virtual env and install required testing packages:
289
+ - Create a virtual env and install required testing packages:
276
290
 
277
291
  ```
278
292
  python -m venv venv
@@ -280,27 +294,20 @@ To report a bug or request a new feature, please open an issue on [GitHub][githu
280
294
  pip install --editable --group dev --group test .
281
295
  ```
282
296
 
283
- Run all tests in the default Python environment:
297
+ - Run all tests in the default Python environment:
284
298
 
285
299
  ```
286
300
  pytest
287
301
  ```
288
302
 
289
- Run all tests, linting, and type checking across all supported/installed
290
- Python environments:
303
+ - Run all tests, linting, and type checking across all supported/installed
304
+ Python environments:
291
305
 
292
306
  ```
293
307
  tox
294
308
  ```
295
309
 
296
- 4. Commit and push your changes
297
-
298
- 5. Submit a [Pull Request][github-prs]
299
-
300
-
301
310
  [github-profile]: https://github.com/cgoldberg
302
311
  [github-repo]: https://github.com/cgoldberg/xvfbwrapper
303
- [github-issues]: https://github.com/cgoldberg/xvfbwrapper/issues
304
- [github-prs]: https://github.com/cgoldberg/xvfbwrapper/pulls
305
312
  [pypi-home]: https://pypi.org/project/xvfbwrapper
306
313
  [mit-license]: https://raw.githubusercontent.com/cgoldberg/xvfbwrapper/refs/heads/master/LICENSE
@@ -17,11 +17,40 @@
17
17
 
18
18
  ## Status
19
19
 
20
- | Type | Status |
21
- | ---- | ------ |
22
- | Build/Tests (CI) | [![Build/Tests (GitHub)](https://github.com/cgoldberg/xvfbwrapper/actions/workflows/test.yml/badge.svg)](https://github.com/cgoldberg/xvfbwrapper/actions/workflows/test.yml) |
23
- | Supported Python Versions | [![Supported Python Versions](https://img.shields.io/pypi/pyversions/xvfbwrapper)](https://pypi.org/project/xvfbwrapper) |
24
- | OSS Sponsorship | [![Tidelift](https://tidelift.com/badges/package/maven/com.fasterxml.uuid:java-uuid-generator)](https://tidelift.com/lifter/search/pypi/xvfbwrapper) |
20
+ <table>
21
+ <tr>
22
+ <td>Latest Version</td>
23
+ <td>
24
+ <a href="https://pypi.org/project/xvfbwrapper">
25
+ <img src="https://img.shields.io/pypi/v/xvfbwrapper.svg">
26
+ </a>
27
+ </td>
28
+ </tr>
29
+ <tr>
30
+ <td>Build/Tests (CI)</td>
31
+ <td>
32
+ <a href="https://github.com/cgoldberg/xvfbwrapper/actions/workflows/test.yml">
33
+ <img src="https://github.com/cgoldberg/xvfbwrapper/actions/workflows/test.yml/badge.svg">
34
+ </a>
35
+ </td>
36
+ </tr>
37
+ <tr>
38
+ <td>Supported Python Versions</td>
39
+ <td>
40
+ <a href="https://pypi.org/project/xvfbwrapper">
41
+ <img src="https://img.shields.io/pypi/pyversions/xvfbwrapper">
42
+ </a>
43
+ </td>
44
+ </tr>
45
+ <tr>
46
+ <td>OSS Sponsorship</td>
47
+ <td>
48
+ <a href="https://tidelift.com/lifter/search/pypi/xvfbwrapper">
49
+ <img src="https://tidelift.com/badges/package/pypi/xvfbwrapper">
50
+ </a>
51
+ </td>
52
+ </tr>
53
+ </table>
25
54
 
26
55
  ----
27
56
 
@@ -200,7 +229,7 @@ os.environ["XDG_SESSION_TYPE"] = "x11"
200
229
  class TestPage(unittest.TestCase):
201
230
 
202
231
  def setUp(self):
203
- xvfb = Xvfb()
232
+ xvfb = Xvfb(set_xdg_session_type=True)
204
233
  xvfb.start()
205
234
  self.driver = webdriver.Chrome()
206
235
  self.addCleanup(xvfb.stop)
@@ -222,26 +251,11 @@ if __name__ == "__main__":
222
251
 
223
252
  ----
224
253
 
225
- ## xvfbwrapper Issues
254
+ ## Development
226
255
 
227
- To report a bug or request a new feature, please open an issue on [GitHub][github-issues].
256
+ - Git: [github.com/cgoldberg/xvfbwrapper.git][github-repo]
228
257
 
229
- ----
230
-
231
- ## xvfbwrapper Development
232
-
233
- 1. Fork the project repo on [GitHub][github-repo]
234
-
235
- 2. Clone the repo:
236
-
237
- ```
238
- git clone https://github.com/<USERNAME>/xvfbwrapper.git
239
- cd xvfbwrapper
240
- ```
241
-
242
- 3. Make changes and run the tests:
243
-
244
- Create a virtual env and install required testing packages:
258
+ - Create a virtual env and install required testing packages:
245
259
 
246
260
  ```
247
261
  python -m venv venv
@@ -249,27 +263,20 @@ To report a bug or request a new feature, please open an issue on [GitHub][githu
249
263
  pip install --editable --group dev --group test .
250
264
  ```
251
265
 
252
- Run all tests in the default Python environment:
266
+ - Run all tests in the default Python environment:
253
267
 
254
268
  ```
255
269
  pytest
256
270
  ```
257
271
 
258
- Run all tests, linting, and type checking across all supported/installed
259
- Python environments:
272
+ - Run all tests, linting, and type checking across all supported/installed
273
+ Python environments:
260
274
 
261
275
  ```
262
276
  tox
263
277
  ```
264
278
 
265
- 4. Commit and push your changes
266
-
267
- 5. Submit a [Pull Request][github-prs]
268
-
269
-
270
279
  [github-profile]: https://github.com/cgoldberg
271
280
  [github-repo]: https://github.com/cgoldberg/xvfbwrapper
272
- [github-issues]: https://github.com/cgoldberg/xvfbwrapper/issues
273
- [github-prs]: https://github.com/cgoldberg/xvfbwrapper/pulls
274
281
  [pypi-home]: https://pypi.org/project/xvfbwrapper
275
282
  [mit-license]: https://raw.githubusercontent.com/cgoldberg/xvfbwrapper/refs/heads/master/LICENSE
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "xvfbwrapper"
7
- version = "0.2.22"
7
+ version = "0.2.24"
8
8
  description = "Manage headless displays with Xvfb (X virtual framebuffer)"
9
9
  license = "MIT"
10
10
  license-files = ["LICENSE"]
@@ -41,17 +41,15 @@ dev = [
41
41
  "tox",
42
42
  ]
43
43
  lint = [
44
- "black",
45
- "refurb",
46
44
  "ruff",
47
45
  ]
48
46
  test = [
49
47
  "psutil",
50
48
  "pytest",
51
- "pytest-cov",
52
49
  ]
53
50
  type = [
54
51
  "mypy",
52
+ "types-psutil",
55
53
  ]
56
54
  validate = [
57
55
  "packaging",
@@ -62,14 +60,8 @@ validate = [
62
60
  [tool.setuptools]
63
61
  py-modules = ["xvfbwrapper"]
64
62
 
65
- [tool.pytest.ini_options]
66
- addopts = "-vv" # extra verbose
67
-
68
- [tool.black]
69
- line-length = 88
70
- target-version = [
71
- "py310", "py311", "py312", "py313", "py314"
72
- ]
63
+ [tool.pytest]
64
+ addopts = ["-v"]
73
65
 
74
66
  [tool.ruff]
75
67
  line-length = 88
@@ -77,18 +69,14 @@ respect-gitignore = true
77
69
  target-version = "py310"
78
70
 
79
71
  [tool.ruff.lint]
80
- fixable = ["ALL"]
81
- select = [
82
- "D", "E", "F", "I", "N", "FURB", "RUF", "TID", "UP", "W"
83
- ]
72
+ select = ["ALL"]
84
73
  extend-ignore = [
85
- "D100", "D101", "D102", "D103", "D105", "D107", "D203", "D213"
74
+ "ANN", "COM812", "D", "EM101", "EM102", "FBT", "PERF203",
75
+ "PLR", "PT", "PYI034", "SLF001", "S101", "S108", "S311",
76
+ "S603", "TRY003", "TRY400"
86
77
  ]
78
+ fixable = ["ALL"]
87
79
 
88
80
  [tool.ruff.format]
89
81
  docstring-code-format = true
90
82
  docstring-code-line-length = 88
91
-
92
- [tool.refurb]
93
- python_version = "3.10"
94
- enable_all = true
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env python3
2
-
2
+ # Copyright (c) 2012-2026 Corey Goldberg
3
+ # SPDX-License-Identifier: MIT
3
4
 
4
5
  """Tests for xvfbwrapper."""
5
6
 
@@ -7,6 +8,7 @@ import os
7
8
  import sys
8
9
  import tempfile
9
10
  import unittest
11
+ from contextlib import suppress
10
12
  from unittest.mock import patch
11
13
 
12
14
  import psutil
@@ -52,10 +54,8 @@ class XvfbCleanTestCase(unittest.TestCase):
52
54
  continue
53
55
  _, alive = psutil.wait_procs(procs, timeout=3)
54
56
  for proc in alive:
55
- try:
57
+ with suppress(psutil.NoSuchProcess, psutil.AccessDenied):
56
58
  proc.kill()
57
- except (psutil.NoSuchProcess, psutil.AccessDenied):
58
- pass
59
59
 
60
60
  # ---------- Class-level ----------
61
61
 
@@ -375,11 +375,13 @@ class TestXvfb(XvfbCleanTestCase):
375
375
  "bar",
376
376
  ]
377
377
  # Force the display socket to never appear
378
- with patch.object(xvfb, "_local_display_exists", return_value=False):
379
- with self.assertRaisesRegex(
378
+ with (
379
+ patch.object(xvfb, "_local_display_exists", return_value=False),
380
+ self.assertRaisesRegex(
380
381
  RuntimeError, f"Xvfb display did not open: {expected_cmd_args}"
381
- ):
382
- xvfb.start()
382
+ ),
383
+ ):
384
+ xvfb.start()
383
385
  # After failure, calling stop() again must not raise an exception
384
386
  xvfb.stop()
385
387
  # We never injected DISPLAY into our custom env
@@ -6,8 +6,6 @@
6
6
  # "tox -e <env>" (i.e.: "tox -e py314" or "tox -e lint")
7
7
  #
8
8
  # This tox configuration will skip any Python interpreters that can't be found.
9
- # To manage multiple Python interpreters for covering all versions, you can use
10
- # pyenv: https://github.com/pyenv/pyenv
11
9
 
12
10
 
13
11
  [tox]
@@ -16,6 +14,9 @@ envlist =
16
14
  lint
17
15
  type
18
16
  py310
17
+ py311
18
+ py312
19
+ py313
19
20
  py314
20
21
  pypy3
21
22
  skip_missing_interpreters = true
@@ -27,7 +28,7 @@ platform = linux|darwin|.*bsd.*
27
28
  dependency_groups =
28
29
  test
29
30
  commands =
30
- pytest --cov=xvfbwrapper {posargs:.}
31
+ pytest {posargs:.}
31
32
 
32
33
 
33
34
  [testenv:validate]
@@ -47,13 +48,8 @@ dependency_groups =
47
48
  lint
48
49
  skip_install = true
49
50
  commands =
50
- # crazy workaround so black doesn't print red messages to console on success
51
- {envpython} -c "import subprocess as s; import sys; "\
52
- "r = s.run(['black', '.'], capture_output=True, text=True, encoding='utf-8'); "\
53
- "sys.stdout.write(r.stderr) if not r.returncode else sys.stderr.write(r.stderr)"
54
51
  ruff check --fix --show-fixes --exit-non-zero-on-fix .
55
52
  ruff format --exit-non-zero-on-format .
56
- refurb xvfbwrapper.py test_xvfb.py
57
53
 
58
54
 
59
55
  [testenv:type]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xvfbwrapper
3
- Version: 0.2.22
3
+ Version: 0.2.24
4
4
  Summary: Manage headless displays with Xvfb (X virtual framebuffer)
5
5
  Author: Corey Goldberg
6
6
  Maintainer: Corey Goldberg
@@ -48,11 +48,40 @@ Dynamic: license-file
48
48
 
49
49
  ## Status
50
50
 
51
- | Type | Status |
52
- | ---- | ------ |
53
- | Build/Tests (CI) | [![Build/Tests (GitHub)](https://github.com/cgoldberg/xvfbwrapper/actions/workflows/test.yml/badge.svg)](https://github.com/cgoldberg/xvfbwrapper/actions/workflows/test.yml) |
54
- | Supported Python Versions | [![Supported Python Versions](https://img.shields.io/pypi/pyversions/xvfbwrapper)](https://pypi.org/project/xvfbwrapper) |
55
- | OSS Sponsorship | [![Tidelift](https://tidelift.com/badges/package/maven/com.fasterxml.uuid:java-uuid-generator)](https://tidelift.com/lifter/search/pypi/xvfbwrapper) |
51
+ <table>
52
+ <tr>
53
+ <td>Latest Version</td>
54
+ <td>
55
+ <a href="https://pypi.org/project/xvfbwrapper">
56
+ <img src="https://img.shields.io/pypi/v/xvfbwrapper.svg">
57
+ </a>
58
+ </td>
59
+ </tr>
60
+ <tr>
61
+ <td>Build/Tests (CI)</td>
62
+ <td>
63
+ <a href="https://github.com/cgoldberg/xvfbwrapper/actions/workflows/test.yml">
64
+ <img src="https://github.com/cgoldberg/xvfbwrapper/actions/workflows/test.yml/badge.svg">
65
+ </a>
66
+ </td>
67
+ </tr>
68
+ <tr>
69
+ <td>Supported Python Versions</td>
70
+ <td>
71
+ <a href="https://pypi.org/project/xvfbwrapper">
72
+ <img src="https://img.shields.io/pypi/pyversions/xvfbwrapper">
73
+ </a>
74
+ </td>
75
+ </tr>
76
+ <tr>
77
+ <td>OSS Sponsorship</td>
78
+ <td>
79
+ <a href="https://tidelift.com/lifter/search/pypi/xvfbwrapper">
80
+ <img src="https://tidelift.com/badges/package/pypi/xvfbwrapper">
81
+ </a>
82
+ </td>
83
+ </tr>
84
+ </table>
56
85
 
57
86
  ----
58
87
 
@@ -231,7 +260,7 @@ os.environ["XDG_SESSION_TYPE"] = "x11"
231
260
  class TestPage(unittest.TestCase):
232
261
 
233
262
  def setUp(self):
234
- xvfb = Xvfb()
263
+ xvfb = Xvfb(set_xdg_session_type=True)
235
264
  xvfb.start()
236
265
  self.driver = webdriver.Chrome()
237
266
  self.addCleanup(xvfb.stop)
@@ -253,26 +282,11 @@ if __name__ == "__main__":
253
282
 
254
283
  ----
255
284
 
256
- ## xvfbwrapper Issues
285
+ ## Development
257
286
 
258
- To report a bug or request a new feature, please open an issue on [GitHub][github-issues].
287
+ - Git: [github.com/cgoldberg/xvfbwrapper.git][github-repo]
259
288
 
260
- ----
261
-
262
- ## xvfbwrapper Development
263
-
264
- 1. Fork the project repo on [GitHub][github-repo]
265
-
266
- 2. Clone the repo:
267
-
268
- ```
269
- git clone https://github.com/<USERNAME>/xvfbwrapper.git
270
- cd xvfbwrapper
271
- ```
272
-
273
- 3. Make changes and run the tests:
274
-
275
- Create a virtual env and install required testing packages:
289
+ - Create a virtual env and install required testing packages:
276
290
 
277
291
  ```
278
292
  python -m venv venv
@@ -280,27 +294,20 @@ To report a bug or request a new feature, please open an issue on [GitHub][githu
280
294
  pip install --editable --group dev --group test .
281
295
  ```
282
296
 
283
- Run all tests in the default Python environment:
297
+ - Run all tests in the default Python environment:
284
298
 
285
299
  ```
286
300
  pytest
287
301
  ```
288
302
 
289
- Run all tests, linting, and type checking across all supported/installed
290
- Python environments:
303
+ - Run all tests, linting, and type checking across all supported/installed
304
+ Python environments:
291
305
 
292
306
  ```
293
307
  tox
294
308
  ```
295
309
 
296
- 4. Commit and push your changes
297
-
298
- 5. Submit a [Pull Request][github-prs]
299
-
300
-
301
310
  [github-profile]: https://github.com/cgoldberg
302
311
  [github-repo]: https://github.com/cgoldberg/xvfbwrapper
303
- [github-issues]: https://github.com/cgoldberg/xvfbwrapper/issues
304
- [github-prs]: https://github.com/cgoldberg/xvfbwrapper/pulls
305
312
  [pypi-home]: https://pypi.org/project/xvfbwrapper
306
313
  [mit-license]: https://raw.githubusercontent.com/cgoldberg/xvfbwrapper/refs/heads/master/LICENSE
@@ -1,5 +1,6 @@
1
- # Corey Goldberg, 2012-2026
2
- # License: MIT
1
+ # Copyright (c) 2012-2026 Corey Goldberg
2
+ # SPDX-License-Identifier: MIT
3
+
3
4
 
4
5
  """Run a headless display inside X virtual framebuffer (Xvfb)."""
5
6
 
@@ -16,9 +17,9 @@ from random import randint
16
17
 
17
18
  try:
18
19
  import fcntl
19
- except ImportError:
20
+ except ImportError as e:
20
21
  system = platform.system()
21
- raise OSError(f"xvfbwrapper is not supported on this platform: {system}")
22
+ raise OSError(f"xvfbwrapper is not supported on this platform: {system}") from e
22
23
 
23
24
 
24
25
  class Xvfb:
@@ -60,7 +61,7 @@ class Xvfb:
60
61
  if not extra_args:
61
62
  extra_args = []
62
63
 
63
- self.extra_xvfb_args = [
64
+ self.extra_xvfb_args: list[str] = [
64
65
  "-screen",
65
66
  "0",
66
67
  f"{self.width}x{self.height}x{self.colordepth}",
@@ -134,7 +135,7 @@ class Xvfb:
134
135
 
135
136
  def _xvfb_exists(self) -> bool:
136
137
  """Check that Xvfb is available on PATH and is executable."""
137
- return True if shutil.which("Xvfb") is not None else False
138
+ return shutil.which("Xvfb") is not None
138
139
 
139
140
  def _cleanup_lock_file(self):
140
141
  """Delete lock files when stopping.
File without changes
File without changes
File without changes