Example #1
0
 def test_SetModule(self):
     cue.update_release_local('MOD1', '/foo/bar')
     found = 0
     for line in fileinput.input(self.release_local, inplace=1):
         if 'MOD1=' in line:
             self.assertEqual(line.strip(), 'MOD1=/foo/bar', 'MOD1 not set correctly')
             found += 1
     fileinput.close()
     self.assertEqual(found, 1, 'MOD1 not written once to RELEASE.local (found {0})'.format(found))
Example #2
0
 def test_SetBaseAndMultipleModules(self):
     cue.update_release_local('EPICS_BASE', '/bar/foo')
     cue.update_release_local('MOD1', '/foo/bar')
     cue.update_release_local('MOD2', '/foo/bar2')
     cue.update_release_local('MOD1', '/foo/bar1')
     found = {}
     foundat = {}
     for line in fileinput.input(self.release_local, inplace=1):
         if 'MOD1=' in line:
             self.assertEqual(
                 line.strip(), 'MOD1=/foo/bar1',
                 'MOD1 not set correctly (expected \'MOD1=/foo/bar1\' found \'{0}\')'
                 .format(line))
             if 'mod1' in found:
                 found['mod1'] += 1
             else:
                 found['mod1'] = 1
             foundat['mod1'] = fileinput.filelineno()
         if 'MOD2=' in line:
             self.assertEqual(
                 line.strip(), 'MOD2=/foo/bar2',
                 'MOD2 not set correctly (expected \'MOD2=/foo/bar2\' found \'{0}\')'
                 .format(line))
             if 'mod2' in found:
                 found['mod2'] += 1
             else:
                 found['mod2'] = 1
             foundat['mod2'] = fileinput.filelineno()
         if 'EPICS_BASE=' in line:
             self.assertEqual(
                 line.strip(), 'EPICS_BASE=/bar/foo',
                 'EPICS_BASE not set correctly (expected \'EPICS_BASE=/bar/foo\' found \'{0}\')'
                 .format(line))
             if 'base' in found:
                 found['base'] += 1
             else:
                 found['base'] = 1
             foundat['base'] = fileinput.filelineno()
     fileinput.close()
     self.assertEqual(
         found['mod1'], 1,
         'MOD1 does not appear once in RELEASE.local (found {0})'.format(
             found['mod1']))
     self.assertEqual(
         found['mod2'], 1,
         'MOD2 does not appear once in RELEASE.local (found {0})'.format(
             found['mod2']))
     self.assertEqual(
         found['base'], 1,
         'EPICS_BASE does not appear once in RELEASE.local (found {0})'.
         format(found['base']))
     self.assertGreater(
         foundat['base'], foundat['mod2'],
         'EPICS_BASE (line {0}) appears before MOD2 (line {1})'.format(
             foundat['base'], foundat['mod2']))
     self.assertGreater(
         foundat['mod2'], foundat['mod1'],
         'MOD2 (line {0}) appears before MOD1 (line {1})'.format(
             foundat['mod2'], foundat['mod1']))