Beispiel #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())
Beispiel #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)
Beispiel #3
0
 def testGetSize(self):
     # Test get_size returns correct value
     script = FSPythonScript('test1', script_path)
     self.assertEqual(len(script.read()),script.get_size())
Beispiel #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())
Beispiel #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())
Beispiel #6
0
 def __call__(self, *args, **kw):
     '''Calls the script.'''
     self._updateFromFS()
     return BaseFSPythonScript.__call__(self, *args, **kw)
Beispiel #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())
Beispiel #8
0
 def __call__(self, *args, **kw):
     '''Calls the script.'''
     self._updateFromFS()
     return BaseFSPythonScript.__call__(self, *args, **kw)