diff --git a/providers/base/bin/camera_test.py b/providers/base/bin/camera_test.py index 3cfec2766e..6394d31a39 100755 --- a/providers/base/bin/camera_test.py +++ b/providers/base/bin/camera_test.py @@ -183,7 +183,7 @@ def __init__(self, **kwargs): self._height = 480 self._devices = [] self.device = kwargs.get("device", "/dev/video0") - self.quiet = kwargs.get("quiet", False) + self.headless = kwargs.get("headless", False) self.output = kwargs.get("output", "") self.log_level = kwargs.get("log_level", logging.INFO) @@ -346,7 +346,7 @@ def video(self): Displays the preview window for a video stream """ # Don't display the video, just run the camera - if self.quiet: + if self.headless: self.main_loop = self.GLib.MainLoop() self.GLib.timeout_add_seconds(4, self._stop_pipeline) self._setup_video_gstreamer("fakesink") @@ -446,7 +446,7 @@ def _still_image_helper(self, filename, width, height, pixelformat): if use_gstreamer: self._capture_image_gstreamer(filename, width, height, pixelformat) print("Image saved to %s" % filename) - if not self.quiet: + if not self.headless: self._display_image(filename, width, height) def _capture_image_fswebcam(self, filename, width, height, pixelformat): @@ -611,7 +611,7 @@ def resolutions(self): take multiple images using the first format returned by the driver, and see if they are valid """ - self.quiet = True + self.headless = True format = self._get_default_format() print( @@ -910,10 +910,10 @@ def add_device_parameter(parser): # Video subparser video_parser = subparsers.add_parser("video") add_device_parameter(video_parser) - # add a quiet option false by default + # add a headless option, false by default video_parser.add_argument( - "-q", - "--quiet", + "-hl", + "--headless", action="store_true", help=("Don't display video, just run the camera"), ) @@ -928,8 +928,8 @@ def add_device_parameter(parser): help="Output directory to store the image", ) image_parser.add_argument( - "-q", - "--quiet", + "-hl", + "--headless", action="store_true", help=("Don't display picture, just write the picture to a file"), ) @@ -977,7 +977,7 @@ def get_video_devices(): camera.init_gstreamer() # Import Gtk only for the test cases that will need it - if args["test"] in ["video", "image"] and not args["quiet"]: + if args["test"] in ["video", "image"] and not args["headless"]: camera.init_gtk() sys.exit(getattr(camera, args["test"])()) diff --git a/providers/base/tests/test_camera_test.py b/providers/base/tests/test_camera_test.py index 95032a4ea3..c303bc5e24 100644 --- a/providers/base/tests/test_camera_test.py +++ b/providers/base/tests/test_camera_test.py @@ -38,12 +38,12 @@ class CameraTestTests(unittest.TestCase): def test_init(self): mock_camera = CameraTest( device="/dev/video1", - quiet=True, + headless=True, output="/tmp", log_level=logging.DEBUG, ) self.assertEqual(mock_camera.device, "/dev/video1") - self.assertEqual(mock_camera.quiet, True) + self.assertEqual(mock_camera.headless, True) self.assertEqual(mock_camera.output, "/tmp") self.assertEqual(mock_camera.log_level, logging.DEBUG) @@ -268,14 +268,14 @@ def test_led(self): def test_video(self): mock_camera = MagicMock() - mock_camera.quiet = False + mock_camera.headless = False CameraTest.video(mock_camera) self.assertEqual(mock_camera.GLib.timeout_add_seconds.call_count, 1) self.assertEqual(mock_camera._setup_video_gstreamer.call_count, 1) - def test_video_quiet(self): + def test_video_headless(self): mock_camera = MagicMock() - mock_camera.quiet = True + mock_camera.headless = True CameraTest.video(mock_camera) self.assertEqual(mock_camera.GLib.timeout_add_seconds.call_count, 1) self.assertEqual(mock_camera._setup_video_gstreamer.call_count, 1) @@ -372,17 +372,17 @@ def test_still_image_helper(self): mock_camera = MagicMock() mock_camera._capture_image_fswebcam.return_value = True mock_camera._display_image.return_value = True - mock_camera.quiet = False + mock_camera.headless = False CameraTest._still_image_helper( mock_camera, "/tmp/test.jpg", 640, 480, "YUYV" ) self.assertEqual(mock_camera._capture_image_fswebcam.call_count, 1) self.assertEqual(mock_camera._display_image.call_count, 1) - def test_still_image_quiet(self): + def test_still_image_headless(self): mock_camera = MagicMock() mock_camera._capture_image_fswebcam.return_value = True - mock_camera.quiet = True + mock_camera.headless = True CameraTest._still_image_helper( mock_camera, "/tmp/test.jpg", 640, 480, "YUYV" ) @@ -793,12 +793,12 @@ def test_image_subparser(self): "/dev/video2", "-o", "/tmp/test.jpg", - "-q", + "-hl", ] args = parse_arguments(argv) self.assertEqual(args["device"], "/dev/video2") self.assertEqual(args["output"], "/tmp/test.jpg") - self.assertEqual(args["quiet"], True) + self.assertEqual(args["headless"], True) def test_debug_flag(self): argv = ["detect"]