Ejemplo n.º 1
0
 def _makeOne(self, id, filename):
     path = join(self.skin_path_name, filename)
     metadata = FSMetadata(filepath=path)
     metadata.read()
     return FSPythonScript(id,
                           filepath=path,
                           properties=metadata.getProperties())
Ejemplo n.º 2
0
    def testInitializationRaceCondition(self):
        # Tries to exercise a former race condition where
        # FSObject._updateFromFS() set self._parsed before the
        # object was really parsed.
        for n in range(10):
            f = Folder()
            script = FSPythonScript('test1', join(self.skin_path_name,'test1.py')).__of__(f)
            res = []

            def call_script(script=script, res=res):
                try:
                    res.append(script())
                except:
                    res.append('%s: %s' % exc_info()[:2])

            start_new_thread(call_script, ())
            call_script()
            while len(res) < 2:
                sleep(0.05)
            self.assertEqual(res, ['test1', 'test1'], res)
Ejemplo n.º 3
0
 def testGetSize(self):
     # Test get_size returns correct value
     script = FSPythonScript('test1', script_path)
     self.assertEqual(len(script.read()),script.get_size())
Ejemplo n.º 4
0
 def test_GetSize(self):
     # Test get_size returns correct value
     script = FSPythonScript('test1', join(self.skin_path_name, 'test1.py'))
     self.assertEqual(len(script.read()), script.get_size())
Ejemplo n.º 5
0
 def test_GetSize(self):
     """ Test get_size returns correct value """
     script = FSPythonScript('test1', script_path)
     self.assertEqual(len(script.read()), script.get_size())
Ejemplo n.º 6
0
 def __call__(self, *args, **kw):
     '''Calls the script.'''
     self._updateFromFS()
     return BaseFSPythonScript.__call__(self, *args, **kw)
Ejemplo n.º 7
0
 def test_GetSize( self ):
     """ Test get_size returns correct value """
     script = FSPythonScript('test1', join(self.skin_path_name,'test1.py'))
     self.assertEqual(len(script.read()),script.get_size())
Ejemplo n.º 8
0
 def __call__(self, *args, **kw):
     '''Calls the script.'''
     self._updateFromFS()
     return BaseFSPythonScript.__call__(self, *args, **kw)