示例#1
0
    def test_acquire(self):
        picture_name = "test.tiff"
        size = (1024, 1024)

        # change resolution
        try:
            # "Andor SimCam" contains a space, so cut the line ourselves
            cmdline = [
                "cli", "--set-attr", "Camera", "resolution",
                "%d,%d" % size
            ]
            ret = main.main(cmdline)
        except SystemExit as exc:
            ret = exc.code
        self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)

        # acquire (simulated) image
        try:
            # "Andor SimCam" contains a space, so cut the line ourselves
            cmdline = [
                "cli", "--acquire", "Camera",
                "--output=%s" % picture_name
            ]
            ret = main.main(cmdline)
        except SystemExit as exc:
            ret = exc.code
        self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)

        st = os.stat(picture_name)  # this test also that the file is created
        self.assertGreater(st.st_size, 0)
        im = Image.open(picture_name)
        self.assertEqual(im.format, "TIFF")
        self.assertEqual(im.size, size)
示例#2
0
 def test_acquire(self):
     picture_name = "test.tiff"
     size = (1024, 1024)
     
     # change resolution
     try:
         # "Andor SimCam" contains a space, so cut the line ourselves
         cmdline = ["cli", "--set-attr", "Camera", "resolution", "%d,%d" % size]
         ret = main.main(cmdline)
     except SystemExit as exc:
         ret = exc.code
     self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)
     
     # acquire (simulated) image
     try:
         # "Andor SimCam" contains a space, so cut the line ourselves
         cmdline = ["cli", "--acquire", "Camera", "--output=%s" % picture_name]
         ret = main.main(cmdline)
     except SystemExit as exc:
         ret = exc.code
     self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)
     
     st = os.stat(picture_name) # this test also that the file is created
     self.assertGreater(st.st_size, 0)
     im = Image.open(picture_name)
     self.assertEqual(im.format, "TIFF")
     self.assertEqual(im.size, size)
示例#3
0
 def test_error_scan(self):
     try:
         cmdline = "cli --scan bar.foo"
         ret = main.main(cmdline.split())
     except SystemExit as exc: # because it's handled by argparse
         ret = exc.code
     self.assertNotEqual(ret, 0, "Wrongly succeeded trying to run scan with unknown class: '%s'" % cmdline)
示例#4
0
 def test_check(self):
     try:
         cmdline = "cli --check"
         ret = main.main(cmdline.split())
     except SystemExit as exc:
         ret = exc.code
     self.assertEqual(ret, 0, "Not detecting backend running")
示例#5
0
 def test_check(self):
     try:
         cmdline = "cli --check"
         ret = main.main(cmdline.split())
     except SystemExit as exc:
         ret = exc.code
     self.assertEqual(ret, 0, "Not detecting backend running")
示例#6
0
 def test_set_attr(self):
     # to read attribute power
     regex = re.compile("\spower\s.*value:\s*([.0-9]+)")
     
     # read before
     try:
         # change the stdout
         out = StringIO.StringIO()
         sys.stdout = out
         
         cmdline = ["cli", "--list-prop", "Light Engine"]
         ret = main.main(cmdline)
     except SystemExit as exc:
         ret = exc.code
     self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)
     
     output = out.getvalue()
     power = float(regex.search(output).group(1))
     self.assertGreaterEqual(power, 0, "power should be bigger than 0")   
     
     # set the new value
     try:
         # change the stdout
         out = StringIO.StringIO()
         sys.stdout = out
         
         cmdline = ["cli", "--set-attr", "Light Engine", "power", "0"]
         ret = main.main(cmdline)
     except SystemExit as exc:
         ret = exc.code
     self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)
     
     # read the new value
     try:
         # change the stdout
         out = StringIO.StringIO()
         sys.stdout = out
         
         cmdline = ["cli", "--list-prop", "Light Engine"]
         ret = main.main(cmdline)
     except SystemExit as exc:
         ret = exc.code
     self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)
     
     output = out.getvalue()
     power = float(regex.search(output).group(1))
     self.assertEqual(power, 0, "power should be 0")
示例#7
0
    def test_set_attr(self):
        # to read attribute power
        regex = re.compile("\spower\s.*value:\s*([.0-9]+)")

        # read before
        try:
            # change the stdout
            out = StringIO.StringIO()
            sys.stdout = out

            cmdline = ["cli", "--list-prop", "Light Engine"]
            ret = main.main(cmdline)
        except SystemExit as exc:
            ret = exc.code
        self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)

        output = out.getvalue()
        power = float(regex.search(output).group(1))
        self.assertGreaterEqual(power, 0, "power should be bigger than 0")

        # set the new value
        try:
            # change the stdout
            out = StringIO.StringIO()
            sys.stdout = out

            cmdline = ["cli", "--set-attr", "Light Engine", "power", "0"]
            ret = main.main(cmdline)
        except SystemExit as exc:
            ret = exc.code
        self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)

        # read the new value
        try:
            # change the stdout
            out = StringIO.StringIO()
            sys.stdout = out

            cmdline = ["cli", "--list-prop", "Light Engine"]
            ret = main.main(cmdline)
        except SystemExit as exc:
            ret = exc.code
        self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)

        output = out.getvalue()
        power = float(regex.search(output).group(1))
        self.assertEqual(power, 0, "power should be 0")
示例#8
0
 def test_error_command_line(self):
     """
     It checks handling when wrong number of argument is given
     """
     try:
         cmdline = "cli --set-attr light power"
         ret = main.main(cmdline.split())
     except SystemExit, exc: # because it's handled by argparse
         ret = exc.code
示例#9
0
 def test_error_command_line(self):
     """
     It checks handling when wrong number of argument is given
     """
     try:
         cmdline = "cli --set-attr light power"
         ret = main.main(cmdline.split())
     except SystemExit, exc:  # because it's handled by argparse
         ret = exc.code
示例#10
0
 def test_scan(self):
     try:
         # change the stdout
         out = StringIO.StringIO()
         sys.stdout = out
         
         cmdline = "cli --log-level=2 --scan"
         ret = main.main(cmdline.split())
     except SystemExit, exc:
         ret = exc.code
示例#11
0
 def test_error_command_line(self):
     """
     It checks handling when wrong number of argument is given
     """
     try:
         cmdline = "cli --set-attr light power"
         ret = main.main(cmdline.split())
     except SystemExit as exc:  # because it's handled by argparse
         ret = exc.code
     self.assertNotEqual(ret, 0, "trying to run erroneous '%s'" % cmdline)
示例#12
0
 def test_list_prop(self):
     try:
         # change the stdout
         out = StringIO.StringIO()
         sys.stdout = out
         
         cmdline = "cli --list-prop Spectra"
         ret = main.main(cmdline.split())
     except SystemExit, exc:
         ret = exc.code
示例#13
0
    def test_list_prop(self):
        try:
            # change the stdout
            out = StringIO.StringIO()
            sys.stdout = out

            cmdline = "cli --list-prop Spectra"
            ret = main.main(cmdline.split())
        except SystemExit, exc:
            ret = exc.code
示例#14
0
 def test_error_scan(self):
     try:
         cmdline = "cli --scan bar.foo"
         ret = main.main(cmdline.split())
     except SystemExit as exc:  # because it's handled by argparse
         ret = exc.code
     self.assertNotEqual(
         ret, 0,
         "Wrongly succeeded trying to run scan with unknown class: '%s'" %
         cmdline)
示例#15
0
 def test_error_command_line(self):
     """
     It checks handling when wrong number of argument is given
     """
     try:
         cmdline = "cli --set-attr light power"
         ret = main.main(cmdline.split())
     except SystemExit as exc: # because it's handled by argparse
         ret = exc.code
     self.assertNotEqual(ret, 0, "trying to run erroneous '%s'" % cmdline)
示例#16
0
 def test_set_attr_dict(self):
     # set a dict, which is a bit complicated structure
     try:
         # change the stdout
         out = StringIO.StringIO()
         sys.stdout = out
         
         cmdline = "cli --set-attr OLStage speed x:0.5,y:0.2"
         ret = main.main(cmdline.split())
     except SystemExit, exc:
         ret = exc.code
示例#17
0
    def test_acquire(self):
        picture_name = "test.tiff"
        size = (1024, 1024)

        # change resolution
        try:
            # "Andor SimCam" contains a space, so use \t as delimiter
            cmdline = "cli\t--set-attr\tAndor SimCam\tresolution\t%d,%d" % size
            ret = main.main(cmdline.split("\t"))
        except SystemExit, exc:
            ret = exc.code
示例#18
0
    def test_set_attr_dict(self):
        # set a dict, which is a bit complicated structure
        try:
            # change the stdout
            out = StringIO.StringIO()
            sys.stdout = out

            cmdline = "cli --set-attr OLStage speed x:0.5,y:0.2"
            ret = main.main(cmdline.split())
        except SystemExit, exc:
            ret = exc.code
示例#19
0
    def test_stop(self):
        try:
            # change the stdout
            out = StringIO.StringIO()
            sys.stdout = out

            cmdline = "cli --stop"
            ret = main.main(cmdline.split())
        except SystemExit as exc:
            ret = exc.code
        self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)
示例#20
0
 def test_acquire(self):
     picture_name = "test.tiff"
     size = (1024, 1024)
     
     # change resolution
     try:
         # "Andor SimCam" contains a space, so use \t as delimiter
         cmdline = "cli\t--set-attr\tAndor SimCam\tresolution\t%d,%d" % size
         ret = main.main(cmdline.split("\t"))
     except SystemExit, exc:
         ret = exc.code
示例#21
0
    def test_position(self):
        try:
            # change the stdout
            out = StringIO.StringIO()
            sys.stdout = out

            cmdline = ["cli", "--position", "Sample Stage", "x", "50e-6"]
            ret = main.main(cmdline)
        except SystemExit as exc:
            ret = exc.code
        self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)
示例#22
0
 def test_stop(self):
     try:
         # change the stdout
         out = StringIO.StringIO()
         sys.stdout = out
         
         cmdline = "cli --stop"
         ret = main.main(cmdline.split())
     except SystemExit as exc:
         ret = exc.code
     self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)
示例#23
0
    def test_position(self):
        try:
            # change the stdout
            out = StringIO.StringIO()
            sys.stdout = out

            cmdline = ["cli", "--position", "Sample Stage", "x", "50e-6"]
            ret = main.main(cmdline)
        except SystemExit as exc:
            ret = exc.code
        self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)
示例#24
0
    def test_move(self):
        # TODO compare position VA
        # test move and also multiple move requests
        try:
            # change the stdout
            out = StringIO.StringIO()
            sys.stdout = out

            cmdline = "cli --move OLStage x 5 --move OLStage y -0.2"
            ret = main.main(cmdline.split())
        except SystemExit, exc:
            ret = exc.code
示例#25
0
 def test_set_attr_dict(self):
     # set a dict, which is a bit complicated structure
     try:
         # change the stdout
         out = StringIO.StringIO()
         sys.stdout = out
         
         cmdline = ["cli", "--set-attr", "Sample Stage", "speed", "x: 0.5, y: 0.2"]
         ret = main.main(cmdline)
     except SystemExit as exc:
         ret = exc.code
     self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)
示例#26
0
 def test_move(self):
     # TODO compare position VA
     # test move and also multiple move requests
     try:
         # change the stdout
         out = StringIO.StringIO()
         sys.stdout = out
         
         cmdline = "cli --move OLStage x 5 --move OLStage y -0.2"
         ret = main.main(cmdline.split())
     except SystemExit, exc:
         ret = exc.code
示例#27
0
 def test_set_attr_dict(self):
     # set a dict, which is a bit complicated structure
     try:
         # change the stdout
         out = StringIO.StringIO()
         sys.stdout = out
         
         cmdline = ["cli", "--set-attr", "OLStage", "speed", "x: 0.5, y: 0.2"]
         ret = main.main(cmdline)
     except SystemExit as exc:
         ret = exc.code
     self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)
示例#28
0
    def test_reference(self):
        # On this simulated hardware, no component supports referencing, so
        # just check that referencing correctly reports this
        try:
            # change the stdout
            out = StringIO.StringIO()
            sys.stdout = out

            cmdline = ["cli", "--reference", "Sample Stage", "x"]
            ret = main.main(cmdline)
        except SystemExit as exc:
            ret = exc.code
        self.assertNotEqual(ret, 0, "Referencing should have failed with '%s'" % cmdline)
示例#29
0
 def test_move(self):
     # TODO compare position VA
     # test move and also multiple move requests
     try:
         # change the stdout
         out = StringIO.StringIO()
         sys.stdout = out
         
         cmdline = ["cli", "--move", "Sample Stage", "x", "5", "--move", "Sample Stage", "y", "-0.2"]
         ret = main.main(cmdline)
     except SystemExit as exc:
         ret = exc.code
     self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)
示例#30
0
 def test_help(self):
     """
     It checks handling help option
     """
     try:
         # change the stdout
         out = StringIO.StringIO()
         sys.stdout = out
         
         cmdline = "cli --help"
         ret = main.main(cmdline.split())
     except SystemExit, exc:
         ret = exc.code
示例#31
0
    def test_reference(self):
        # On this simulated hardware, no component supports referencing, so
        # just check that referencing correctly reports this
        try:
            # change the stdout
            out = StringIO.StringIO()
            sys.stdout = out

            cmdline = "cli --reference OLStage x"
            ret = main.main(cmdline.split())
        except SystemExit as exc:
            ret = exc.code
        self.assertNotEqual(ret, 0, "Referencing should have failed with '%s'" % cmdline)
示例#32
0
 def test_set_attr(self):
     # to read attribute power
     regex = re.compile("\spower\s.*value:\s*([.0-9]+)")
     
     # read before
     try:
         # change the stdout
         out = StringIO.StringIO()
         sys.stdout = out
         
         cmdline = "cli --list-prop Spectra"
         ret = main.main(cmdline.split())
     except SystemExit, exc:
         ret = exc.code
示例#33
0
    def test_position_deg_fail(self):
        """converting position into degrees shouldn't be possible for axes in meters"""
        try:
            # change the stdout
            out = BytesIO()
            sys.stdout = out

            cmdline = [
                "cli", "--position", "Sample Stage", "x", "50e-6", "--degrees"
            ]
            ret = main.main(cmdline)
        except SystemExit as exc:
            ret = exc.code
        self.assertNotEqual(ret, 0, "trying to run '%s' should fail" % cmdline)
示例#34
0
    def test_reference(self):
        # On this simulated hardware, no component supports referencing, so
        # just check that referencing correctly reports this
        try:
            # change the stdout
            out = BytesIO()
            sys.stdout = out

            cmdline = ["cli", "--reference", "Sample Stage", "x"]
            ret = main.main(cmdline)
        except SystemExit as exc:
            ret = exc.code
        self.assertNotEqual(
            ret, 0, "Referencing should have failed with '%s'" % cmdline)
示例#35
0
    def test_set_attr(self):
        # to read attribute power
        regex = re.compile("\spower\s.*value:\s*([.0-9]+)")

        # read before
        try:
            # change the stdout
            out = StringIO.StringIO()
            sys.stdout = out

            cmdline = "cli --list-prop Spectra"
            ret = main.main(cmdline.split())
        except SystemExit, exc:
            ret = exc.code
示例#36
0
    def test_list(self):
        try:
            # change the stdout
            out = StringIO.StringIO()
            sys.stdout = out

            cmdline = "cli --list"
            ret = main.main(cmdline.split())
        except SystemExit as exc:
            ret = exc.code
        self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)

        output = out.getvalue()
        self.assertTrue("Light Engine" in output)
        self.assertTrue("Camera" in output)
示例#37
0
 def test_list(self):
     try:
         # change the stdout
         out = StringIO.StringIO()
         sys.stdout = out
         
         cmdline = "cli --list"
         ret = main.main(cmdline.split())
     except SystemExit as exc:
         ret = exc.code
     self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)
     
     output = out.getvalue()
     self.assertTrue("Light Engine" in output)
     self.assertTrue("Camera" in output)
示例#38
0
 def test_list_prop(self):
     try:
         # change the stdout
         out = StringIO.StringIO()
         sys.stdout = out
         
         cmdline = ["cli", "--list-prop", "Light Engine"]
         ret = main.main(cmdline)
     except SystemExit as exc:
         ret = exc.code
     self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)
     
     output = out.getvalue()
     self.assertTrue("role" in output)
     self.assertTrue("swVersion" in output)
     self.assertTrue("power" in output)
示例#39
0
    def test_list_prop(self):
        try:
            # change the stdout
            out = StringIO.StringIO()
            sys.stdout = out

            cmdline = ["cli", "--list-prop", "Light Engine"]
            ret = main.main(cmdline)
        except SystemExit as exc:
            ret = exc.code
        self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)

        output = out.getvalue()
        self.assertTrue("role" in output)
        self.assertTrue("swVersion" in output)
        self.assertTrue("power" in output)
示例#40
0
    def test_move(self):
        # TODO compare position VA
        # test move and also multiple move requests
        try:
            # change the stdout
            out = StringIO.StringIO()
            sys.stdout = out

            cmdline = [
                "cli", "--move", "Sample Stage", "x", "5", "--move",
                "Sample Stage", "y", "-0.2"
            ]
            ret = main.main(cmdline)
        except SystemExit as exc:
            ret = exc.code
        self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)
示例#41
0
    def test_help(self):
        """
        It checks handling help option
        """
        try:
            # change the stdout
            out = BytesIO()
            sys.stdout = out
            cmdline = "cli --help"
            ret = main.main(cmdline.split())
        except SystemExit as exc:
            ret = exc.code
        self.assertEqual(ret, 0,
                         "trying to run '%s' returned %s" % (cmdline, ret))

        output = out.getvalue()
        self.assertTrue(b"optional arguments" in output)
示例#42
0
    def test_scan(self):
        try:
            # change the stdout
            out = StringIO.StringIO()
            sys.stdout = out
            
            cmdline = "cli --log-level=2 --scan"
            ret = main.main(cmdline.split())
        except SystemExit as exc:
            ret = exc.code
        self.assertEqual(ret, 0, "trying to run '%s' returned %s" % (cmdline, ret))
        
        output = out.getvalue()
        # AndorCam3 SimCam should be there for sure (if libandor3-dev is installed)
        # self.assertTrue("andorcam3.AndorCam3" in output)

        self.assertTrue("andorcam2.FakeAndorCam2" in output)
示例#43
0
 def test_help(self):
     """
     It checks handling help option
     """
     try:
         # change the stdout
         out = StringIO.StringIO()
         sys.stdout = out
         
         cmdline = "cli --help"
         ret = main.main(cmdline.split())
     except SystemExit as exc:
         ret = exc.code
     self.assertEqual(ret, 0, "trying to run '%s' returned %s" % (cmdline, ret))
     
     output = out.getvalue()
     self.assertTrue("optional arguments" in output)
示例#44
0
    def test_scan(self):
        try:
            # change the stdout
            out = StringIO.StringIO()
            sys.stdout = out

            cmdline = "cli --log-level=2 --scan"
            ret = main.main(cmdline.split())
        except SystemExit as exc:
            ret = exc.code
        self.assertEqual(ret, 0,
                         "trying to run '%s' returned %s" % (cmdline, ret))

        output = out.getvalue()
        # AndorCam3 SimCam should be there for sure (if libandor3-dev is installed)
        # self.assertTrue("andorcam3.AndorCam3" in output)

        self.assertTrue("andorcam2.FakeAndorCam2" in output)
示例#45
0
        except SystemExit, exc:
            ret = exc.code
        self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)

        output = out.getvalue()
        power = float(regex.search(output).group(1))
        self.assertGreaterEqual(power, 0, "power should be bigger than 0")

        # set the new value
        try:
            # change the stdout
            out = StringIO.StringIO()
            sys.stdout = out

            cmdline = "cli --set-attr Spectra power 0"
            ret = main.main(cmdline.split())
        except SystemExit, exc:
            ret = exc.code
        self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)

        # read the new value
        try:
            # change the stdout
            out = StringIO.StringIO()
            sys.stdout = out

            cmdline = "cli --list-prop Spectra"
            ret = main.main(cmdline.split())
        except SystemExit, exc:
            ret = exc.code
        self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)
示例#46
0
 except SystemExit, exc:
     ret = exc.code
 self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)
 
 output = out.getvalue()
 power = float(regex.search(output).group(1))
 self.assertGreaterEqual(power, 0, "power should be bigger than 0")   
 
 # set the new value
 try:
     # change the stdout
     out = StringIO.StringIO()
     sys.stdout = out
     
     cmdline = "cli --set-attr Spectra power 0"
     ret = main.main(cmdline.split())
 except SystemExit, exc:
     ret = exc.code
 self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)
 
 # read the new value
 try:
     # change the stdout
     out = StringIO.StringIO()
     sys.stdout = out
     
     cmdline = "cli --list-prop Spectra"
     ret = main.main(cmdline.split())
 except SystemExit, exc:
     ret = exc.code
 self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)
示例#47
0
 def test_check(self):
     try:
         cmdline = "cli --check"
         ret = main.main(cmdline.split())
     except SystemExit, exc:
         ret = exc.code
示例#48
0
 def test_error_scan(self):
     try:
         cmdline = "cli --scan bar.foo"
         ret = main.main(cmdline.split())
     except SystemExit, exc: # because it's handled by argparse
         ret = exc.code
示例#49
0
 def test_check(self):
     try:
         cmdline = "cli --check"
         ret = main.main(cmdline.split())
     except SystemExit, exc:
         ret = exc.code
示例#50
0
 def test_error_scan(self):
     try:
         cmdline = "cli --scan bar.foo"
         ret = main.main(cmdline.split())
     except SystemExit, exc:  # because it's handled by argparse
         ret = exc.code
示例#51
0
    def test_set_attr(self):
        # to read attribute power (which is a list of numbers)
        regex = re.compile(b"\spower.+ value: \[(.*?)\]")

        # read before
        try:
            # change the stdout
            out = BytesIO()
            sys.stdout = out

            cmdline = ["cli", "--list-prop", "Light Engine"]
            ret = main.main(cmdline)
        except SystemExit as exc:
            ret = exc.code
        self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)

        output = out.getvalue()
        # Parse each individual power value from the power list
        power_val_str = [
            val_str
            for val_str in str(regex.search(output).group(1)).split(",")
        ]
        power = [
            float(re.search(r"([.0-9]+)", val).group(0))
            for val in power_val_str
        ]
        self.assertTrue(any(pw >= 0 for pw in power),
                        "Power values should be bigger than 0")

        # set the new value
        try:
            # change the stdout
            out = BytesIO()
            sys.stdout = out

            cmdline = [
                "cli", "--set-attr", "Light Engine", "power",
                str([0.0 for _ in power])
            ]
            ret = main.main(cmdline)
        except SystemExit as exc:
            ret = exc.code
        self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)

        # read the new value
        try:
            # change the stdout
            out = BytesIO()
            sys.stdout = out

            cmdline = ["cli", "--list-prop", "Light Engine"]
            ret = main.main(cmdline)
        except SystemExit as exc:
            ret = exc.code
        self.assertEqual(ret, 0, "trying to run '%s'" % cmdline)

        output = out.getvalue()
        power_val_str = [
            val_str
            for val_str in str(regex.search(output).group(1)).split(",")
        ]
        power = [
            float(re.search(r"([.0-9]+)", val).group(0))
            for val in power_val_str
        ]
        self.assertTrue(all(pw == 0 for pw in power),
                        "Power values should be 0")