예제 #1
0
    def _setup_script(self, spec):
        p = spec.script
        if os.path.isfile(p):
            self.debug('measurement script "{}"'.format(p))
            root = os.path.dirname(p)
            sname = os.path.basename(p)

            #setup the script
            ms = MeasurementPyScript(root=root,
                                     name=sname,
                                     automated_run=self.arun)
            if ms.bootstrap():
                if ms.syntax_ok(warn=False):
                    spec.duration = ms.get_estimated_duration()
                    pms=None
                    p=spec.post_measurement_script
                    if p and os.path.isfile(p):
                        self.debug('measurement script "{}"'.format(p))
                        pms=ExtractionPyScript(root=os.path.dirname(p),
                                               name=os.path.basename(p))
                    return ms, pms
                else:
                    self.debug('invalid syntax {}'.format(ms.name))

        self.debug('invalid measurement script "{}"'.format(p))
예제 #2
0
    def _setup_script(self, spec):
        p = spec.script
        if os.path.isfile(p):
            self.debug('measurement script "{}"'.format(p))
            root = os.path.dirname(p)
            sname = os.path.basename(p)

            #setup the script
            ms = MeasurementPyScript(root=root,
                                     name=sname,
                                     automated_run=self.arun)
            if ms.bootstrap():
                if ms.syntax_ok(warn=False):
                    spec.duration = ms.get_estimated_duration()
                    pms = None
                    p = spec.post_measurement_script
                    if p and os.path.isfile(p):
                        self.debug('measurement script "{}"'.format(p))
                        pms = ExtractionPyScript(root=os.path.dirname(p),
                                                 name=os.path.basename(p))
                    return ms, pms
                else:
                    self.debug('invalid syntax {}'.format(ms.name))

        self.debug('invalid measurement script "{}"'.format(p))
예제 #3
0
파일: pyscript.py 프로젝트: sgallet/pychron
class PyscriptDurationTest(unittest.TestCase):
    def setUp(self):
        self._script = MeasurementPyScript()

    def testDuration(self):
        self._script.root = './data'
        self._script.name = 'measurement_script.py'
        self._script.bootstrap()

        self._script.test()
        etd = self._script.get_estimated_duration()
        mc = 4
        bs = 2
        eq = 2
        st = 4
        td = mc + bs + eq + st
        self.assertEqual(etd, td)