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())
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)
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())
def test_GetSize(self): """ Test get_size returns correct value """ script = FSPythonScript('test1', script_path) self.assertEqual(len(script.read()), script.get_size())