• Home
  • Raw
  • Download

Lines Matching +full:python3 +full:- +full:pytest

1 #!/usr/bin/env python3
3 # -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
33 import pytest
35 print("Failed to import pytest. Skipping.", file=sys.stderr)
64 if p.returncode == -3:
66 return p.returncode, stdout.decode("UTF-8"), stderr.decode("UTF-8")
116 def __init__(self, subtool="debug-gui"):
117 assert subtool == "debug-gui"
122 pytest.skip()
125 pytest.skip()
129 rc, _, _ = self.run_command(["--help"])
131 pytest.skip()
135 if subtool == "debug-gui":
141 @pytest.fixture
146 @pytest.fixture(params=["debug-events", "debug-gui"])
151 @pytest.fixture
153 return get_tool("debug-events")
156 @pytest.fixture
158 return get_tool("debug-gui")
161 @pytest.fixture
167 stdout, stderr = libinput.run_command_success(["--help"])
173 stdout, stderr = libinput.run_command_success(["--version"])
178 @pytest.mark.parametrize("argument", ["--banana", "--foo", "--quiet", "--verbose"])
183 @pytest.mark.parametrize("tool", [["foo"], ["debug"], ["foo", "--quiet"]])
189 libinput_debug_tool.run_command_missing_arg(["--udev"])
190 libinput_debug_tool.run_command_success(["--udev", "seat0"])
191 libinput_debug_tool.run_command_success(["--udev", "seat1"])
194 @pytest.mark.skipif(os.environ.get("UDEV_NOT_AVAILABLE"), reason="udev required")
196 libinput_debug_tool.run_command_missing_arg(["--device"])
197 libinput_debug_tool.run_command_success(["--device", "/dev/input/event0"])
198 libinput_debug_tool.run_command_success(["--device", "/dev/input/event1"])
205 "enable-disable": [
208 "drag-lock",
210 "natural-scrolling",
211 "left-handed",
217 "set-click-method": ["none", "clickfinger", "buttonareas"],
218 "set-scroll-method": ["none", "twofinger", "edge", "button"],
219 "set-profile": ["adaptive", "flat"],
220 "set-tap-map": ["lrm", "lmr"],
224 "set-speed": (-1.0, +1.0, 0.1),
225 "set-rotation": (0, 360, 10),
231 @pytest.mark.parametrize("option", options["pattern"])
233 libinput_debug_tool.run_command_success(["--disable-{}".format(option), "*"])
234 libinput_debug_tool.run_command_success(["--disable-{}".format(option), "abc*"])
237 @pytest.mark.parametrize("option", options["enable-disable"])
239 libinput_debug_tool.run_command_success(["--enable-{}".format(option)])
240 libinput_debug_tool.run_command_success(["--disable-{}".format(option)])
243 @pytest.mark.parametrize("option", options["enums"].items())
247 libinput_debug_tool.run_command_success(["--{}".format(name), v])
248 libinput_debug_tool.run_command_success(["--{}={}".format(name, v)])
251 @pytest.mark.parametrize("option", options["ranges"].items())
257 libinput_debug_tool.run_command_success(["--{}".format(name), str(value)])
258 libinput_debug_tool.run_command_success(["--{}={}".format(name, value)])
260 libinput_debug_tool.run_command_success(["--{}".format(name), str(maximum)])
261 libinput_debug_tool.run_command_success(["--{}={}".format(name, maximum)])
265 libinput_debug_tool.run_command_missing_arg(["--apply-to"])
266 libinput_debug_tool.run_command_success(["--apply-to", "*foo*"])
267 libinput_debug_tool.run_command_success(["--apply-to", "foobar"])
268 libinput_debug_tool.run_command_success(["--apply-to", "any"])
271 @pytest.mark.parametrize(
273 [["--verbose"], ["--quiet"], ["--verbose", "--quiet"], ["--quiet", "--verbose"]],
279 @pytest.mark.parametrize("arg", ["--banana", "--foo", "--version"])
286 ["--device", "/dev/input/event0", "/dev/input/event1"]
290 ["--device", "/dev/input/event0", "/dev/input/event0"]
303 @pytest.mark.parametrize("arg", ["--quiet"])
309 libinput_debug_gui.run_command_success(["--verbose"])
312 @pytest.mark.parametrize(
313 "arg", ["--help", "--show-keycodes", "--with-libinput", "--with-hidraw"]
321 libinput_record.run_command_success(["--multiple"])
324 @pytest.fixture
330 libinput_record.run_command_success(["--all", "-o", recording])
331 libinput_record.run_command_success(["--all", recording])
335 libinput_record.run_command_success(["-o", recording])
336 libinput_record.run_command_success(["--output-file", recording])
337 libinput_record.run_command_success(["--output-file={}".format(recording)])
342 libinput_record.run_command_success(["-o", recording, "/dev/input/event0"])
349 ["-o", recording, "/dev/input/event0", "/dev/input/event1"]
360 libinput_record.run_command_invalid(["--autorestart"])
361 libinput_record.run_command_invalid(["--autorestart=2"])
362 libinput_record.run_command_success(["-o", recording, "--autorestart=2"])
366 args = ["-m", "pytest"]
371 args += ["-n", ncores]
373 logger.info("python-xdist missing, this test will be slow")