Beispiel #1
0
    def test_secom(self):
        """
        Check it properly detects that a SECOM is missing a component
        """
        # Start the backend
        try:
            broken_config_path = CONFIG_PATH + "sim/secom-sim.odm.yaml"
            test.start_backend(broken_config_path)
        except LookupError:
            logging.info("A running backend is already found, skipping tests")
            self.skipTest("Running backend found")
        except IOError as exp:
            logging.error(str(exp))
            raise

        # Check it fails
        microscope = model.getMicroscope()
        gdata = MainGUIData(microscope)

        self.assertEqual(gdata.microscope, microscope)
        self.assertEqual(gdata.role, microscope.role)

        self.assertIsInstance(gdata.ccd, model.ComponentBase)
        self.assertIn(gdata.ccd, gdata.ccds)
        self.assertIsInstance(gdata.stage, model.ComponentBase)
        self.assertIsNone(gdata.spectrograph)

        self.assertIsNotNone(gdata.opm)
        self.assertIsNotNone(gdata.settings_obs)

        test.stop_backend()
Beispiel #2
0
    def setUpClass(cls):
        if driver.get_backend_status() in driver.BACKEND_RUNNING:
            microscope = model.getMicroscope()
            if microscope.role != "meteor":
                logging.info(
                    "There is already running backend. It will be turned off, and the backend of METEOR will be turned on."
                )
                test.stop_backend()
                test.start_backend(METEOR_CONFIG)
            else:
                logging.info(
                    "There is METEOR backend already running. It will be used."
                )
        else:
            try:
                logging.info("METEOR backend will be turned on.")
                test.start_backend(METEOR_CONFIG)
            except Exception:
                raise

        # get the stage components
        cls.stage = model.getComponent(role="stage-bare")

        # get the metadata
        stage_md = cls.stage.getMetadata()
        cls.stage_grid_centers = stage_md[model.MD_SAMPLE_CENTERS]
        cls.stage_loading = stage_md[model.MD_FAV_POS_DEACTIVE]
Beispiel #3
0
 def tearDown(self):
     sys.stdout = self.saved_stdout
     # Make sure the backend is stopped
     try:
         test.stop_backend()
     except Exception:
         try:  # Try harder
             subprocess.call(["sudo", "odemis-stop"])
         except Exception:
             pass  # Odemis is not installed, too bad
Beispiel #4
0
    def tearDownClass(cls):
        if cls.backend_was_running:
            return

#        print gc.get_referrers(cls.optmngr)
        del cls.optmngr  # To garbage collect it
#         logging.debug("Current number of threads: %d", threading.active_count())
#         for t in threading.enumerate():
#             print "Thread %d: %s" % (t.ident, t.name)
        test.stop_backend()
Beispiel #5
0
    def tearDownClass(cls):
        if cls.backend_was_running:
            return

#        print gc.get_referrers(cls.optmngr)
        del cls.optmngr  # To garbage collect it
        #         logging.debug("Current number of threads: %d", threading.active_count())
        #         for t in threading.enumerate():
        #             print "Thread %d: %s" % (t.ident, t.name)
        test.stop_backend()
Beispiel #6
0
 def tearDown(self):
     sys.stdout = self.saved_stdout
     # Make sure the backend is stopped
     try:
         test.stop_backend()
     except Exception:
         try:  # Try harder
             subprocess.call(["sudo", "odemis-stop"])
         except Exception:
             pass  # Odemis is not installed, too bad
Beispiel #7
0
    def test_speedUpPyroConnect(self):
        try:
            test.start_backend(SECOM_CONFIG)
            need_stop = True
        except LookupError:
            logging.info("A running backend is already found, will not stop it")
            need_stop = False
        except IOError as exp:
            logging.error(str(exp))
            raise

        model._components._microscope = None # force reset of the microscope for next connection

        speedUpPyroConnect(model.getMicroscope())

        time.sleep(2)
        if need_stop:
            test.stop_backend()
Beispiel #8
0
    def test_speedUpPyroConnect(self):
        try:
            test.start_backend(SECOM_CONFIG)
            need_stop = True
        except LookupError:
            logging.info(
                "A running backend is already found, will not stop it")
            need_stop = False
        except IOError as exp:
            logging.error(str(exp))
            raise

        model._components._microscope = None  # force reset of the microscope for next connection

        speedUpPyroConnect(model.getMicroscope())

        time.sleep(2)
        if need_stop:
            test.stop_backend()
Beispiel #9
0
    def test_secom_missing_stage(self):
        """
        Check it properly detects that a SECOM is missing a component
        """
        # Start the backend
        try:
            broken_config_path = os.path.dirname(
                __file__) + "/secom-sim-no-stage.odm.yaml"
            test.start_backend(broken_config_path)
        except LookupError:
            logging.info("A running backend is already found, skipping tests")
            self.skipTest("Running backend found")
        except IOError as exp:
            logging.error(str(exp))
            raise

        # Check it fails
        microscope = model.getMicroscope()
        with self.assertRaises(KeyError):
            MainGUIData(microscope)

        test.stop_backend()
 def tearDownClass(cls):
     if cls.backend_was_running:
         return
     test.stop_backend()
Beispiel #11
0
    def tearDownClass(cls):
        time.sleep(1.0)

        if cls.backend_was_running:
            return
        test.stop_backend()
Beispiel #12
0
 def tearDownClass(cls):
     if cls.backend_was_running:
         return
     del cls.optmngr  # To garbage collect it
     test.stop_backend()
Beispiel #13
0
 def tearDownClass(cls):
     if driver.get_backend_status == BACKEND_RUNNING:
         test.stop_backend()
Beispiel #14
0
 def tearDownClass(cls):
     # turn off everything when the testing finished.
     if driver.get_backend_status() == driver.BACKEND_RUNNING:
         test.stop_backend()
Beispiel #15
0
 def setUpClass(cls):
     # make sure initially no backend is running.
     if driver.get_backend_status() == driver.BACKEND_RUNNING:
         test.stop_backend()
Beispiel #16
0
 def tearDownClass(cls):
     if cls.backend_was_running:
         return
     del cls.optmngr  # To garbage collect it
     test.stop_backend()
 def tearDownClass(cls):
     if cls.backend_was_running:
         return
     test.stop_backend()
Beispiel #18
0
    def tearDownClass(cls):
        time.sleep(1.0)

        if cls.backend_was_running:
            return
        test.stop_backend()