Changeset 478 in tmcsimulator for trunk/src/python


Ignore:
Timestamp:
08/23/2019 02:04:05 PM (7 years ago)
Author:
jdalbey
Message:

Fix typo in actitivylog watcher and add simple unit test of logging service methods

Location:
trunk/src/python/unifiedlogger
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/python/unifiedlogger/activitylog_watcher.py

    r470 r478  
    5454        code = item[4].replace(',','') 
    5555        msg = item[5].replace(',','') 
    56         desiredFields = "Activity Log.,"+name+","+code+","+msg 
     56        desiredFields = "Activity Log.,"+name+","+code+" "+msg 
    5757        # Append to results list 
    5858        resultList.append(desiredFields) 
  • trunk/src/python/unifiedlogger/wing_project.wpr

    r471 r478  
    66[project attributes] 
    77debug.launch-configs = (2, 
    8                         {'launch-Dap54cn2qAN7AXZm': ({}, 
     8                        {'launch-79fWcT8eQm1A3xyz': ({}, 
     9        {'buildcmd': ('project', 
     10                      None), 
     11         'env': ('project', 
     12                 [u'']), 
     13         'name': 'unit test', 
     14         'pyexec': ('custom', 
     15                    u'/usr/bin/pytest'), 
     16         'pypath': ('project', 
     17                    []), 
     18         'pyrunargs': ('project', 
     19                       '-u'), 
     20         'runargs': u'', 
     21         'rundir': ('custom', 
     22                    u'/home/jdalbey/Dropbox/TMCrepo/trunk/src/python/unifiedlogger')}), 
     23                         'launch-Dap54cn2qAN7AXZm': ({}, 
    924        {'buildcmd': ('project', 
    1025                      None), 
     
    3247        (u'', 
    3348         'launch-Dap54cn2qAN7AXZm'))} 
    34 proj.main-file = loc('__main__.py') 
    3549[user attributes] 
    3650debug.show-args-dialog = {loc('__main__.py'): False} 
    37 edit.file-encoding = {loc('get_revision'): 'UTF-8'} 
     51edit.file-encoding = {loc('get_revision'): 'UTF-8', 
     52                      loc('test_logging_service.py'): 'UTF-8'} 
    3853guimgr.overall-gui-state = {'windowing-policy': 'combined-window', 
    3954                            'windows': [{'name': '0BtsNVOAornvyNAPNOxHAmuDFR'\ 
     
    85100        'current_pages': [3, 
    86101                          1], 
    87         'notebook_display': 'hidden', 
     102        'notebook_display': 'normal', 
    88103        'notebook_percent': 0.30000000000000004, 
    89104        'override_title': None, 
     
    183198                       'toolbox-percent': 1.0, 
    184199                       'toolbox-tree-sel': ''})], 
    185         'primary_view_state': {'editor_states': ({'bookmarks': ([[loc('cad_watcher.py'), 
    186         {'attrib-starts': [('isFull|0|', 
    187                             16)], 
    188          'code-line': '\n', 
    189          'first-line': 27L, 
     200        'primary_view_state': {'editor_states': ({'bookmarks': ([[loc('activitylog_watcher.py'), 
     201        {'attrib-starts': [('getLogEntries|0|', 
     202                            42)], 
     203         'code-line': '        desiredFields = "Activity Log.,"+name+","+cod'\ 
     204                      'e+","+msg\n', 
     205         'first-line': 33L, 
    190206         'folded-linenos': [], 
    191          'sel-line': 18L, 
    192          'sel-line-start': 559L, 
    193          'selection_end': 559L, 
    194          'selection_start': 559L, 
     207         'sel-line': 55L, 
     208         'sel-line-start': 1666L, 
     209         'selection_end': 1728L, 
     210         'selection_start': 1728L, 
    195211         'zoom': 0L}, 
    196         1564182715.806107], 
    197         [loc('logging_service.py'), 
    198          {'attrib-starts': [('startup|0|', 
    199                              20)], 
    200           'code-line': '    #       Append simulation time and the log entri'\ 
    201                        'es to the Output Buffer\n', 
    202           'first-line': 38L, 
    203           'folded-linenos': [], 
    204           'sel-line': 55L, 
    205           'sel-line-start': 1843L, 
    206           'selection_end': 1851L, 
    207           'selection_start': 1851L, 
    208           'zoom': 0L}, 
    209          1564182751.746078], 
    210         [loc('cad_watcher.py'), 
    211          {'attrib-starts': [('isFull|0|', 
    212                              16)], 
    213           'code-line': '\n', 
    214           'first-line': 21L, 
    215           'folded-linenos': [], 
    216           'sel-line': 18L, 
    217           'sel-line-start': 559L, 
    218           'selection_end': 559L, 
    219           'selection_start': 559L, 
    220           'zoom': 0L}, 
    221          1564182793.261813], 
    222         [loc('__main__.py'), 
    223          {'attrib-starts': [], 
    224           'code-line': 'import logging_service, os, ConfigParser\n', 
    225           'first-line': 0L, 
    226           'folded-linenos': [], 
    227           'sel-line': 0L, 
    228           'sel-line-start': 0L, 
    229           'selection_end': 40L, 
    230           'selection_start': 28L, 
    231           'zoom': 0L}, 
    232          1564182798.481531], 
    233         [loc('logging_service.py'), 
    234          {'attrib-starts': [('startup|0|', 
    235                              20)], 
    236           'code-line': '    #       Append simulation time and the log entri'\ 
    237                        'es to the Output Buffer\n', 
    238           'first-line': 0L, 
    239           'folded-linenos': [], 
    240           'sel-line': 55L, 
    241           'sel-line-start': 1843L, 
    242           'selection_end': 1851L, 
    243           'selection_start': 1851L, 
    244           'zoom': 0L}, 
    245          1564182969.909882], 
    246         [loc('cad_watcher.py'), 
    247          {'attrib-starts': [], 
    248           'code-line': 'lastLineNum = 0\n', 
    249           'first-line': 7L, 
    250           'folded-linenos': [], 
    251           'sel-line': 11L, 
    252           'sel-line-start': 417L, 
    253           'selection_end': 432L, 
    254           'selection_start': 432L, 
    255           'zoom': 0L}, 
    256          1564183893.9794], 
    257         [loc('logging_service.py'), 
    258          {'attrib-starts': [('startup|0|', 
    259                              20)], 
    260           'code-line': '    #       Append simulation time and the log entri'\ 
    261                        'es to the Output Buffer\n', 
    262           'first-line': 39L, 
    263           'folded-linenos': [], 
    264           'sel-line': 55L, 
    265           'sel-line-start': 1843L, 
    266           'selection_end': 1851L, 
    267           'selection_start': 1851L, 
    268           'zoom': 0L}, 
    269          1564184320.038293], 
    270         [loc('cad_watcher.py'), 
    271          {'attrib-starts': [], 
    272           'code-line': 'lastLineNum = 0\n', 
    273           'first-line': 10L, 
    274           'folded-linenos': [], 
    275           'sel-line': 11L, 
    276           'sel-line-start': 417L, 
    277           'selection_end': 432L, 
    278           'selection_start': 432L, 
    279           'zoom': 0L}, 
    280          1564189528.213135], 
    281         [loc('logging_service.py'), 
    282          {'attrib-starts': [('startup|0|', 
    283                              20)], 
    284           'code-line': '    #       Append simulation time and the log entri'\ 
    285                        'es to the Output Buffer\n', 
    286           'first-line': 21L, 
    287           'folded-linenos': [], 
    288           'sel-line': 55L, 
    289           'sel-line-start': 1843L, 
    290           'selection_end': 1851L, 
    291           'selection_start': 1851L, 
    292           'zoom': 0L}, 
    293          1564189539.194298], 
    294         [loc('cad_watcher.py'), 
    295          {'attrib-starts': [('setup|0|', 
    296                              41)], 
    297           'code-line': 'def setup():\n', 
    298           'first-line': 24L, 
    299           'folded-linenos': [], 
    300           'sel-line': 41L, 
    301           'sel-line-start': 1329L, 
    302           'selection_end': 1329L, 
    303           'selection_start': 1329L, 
    304           'zoom': 0L}, 
    305          1564287471.970187], 
    306         [loc('../../../../../../../../usr/lib/python2.7/genericpath.py'), 
    307          {'attrib-starts': [('getsize|0|', 
    308                              54)], 
    309           'code-line': '    return os.stat(filename).st_size\n', 
    310           'first-line': 39L, 
    311           'folded-linenos': [], 
    312           'sel-line': 56L, 
    313           'sel-line-start': 1506L, 
    314           'selection_end': 1506L, 
    315           'selection_start': 1506L, 
    316           'zoom': 0L}, 
    317          1564287481.404096], 
    318         [loc('cad_watcher.py'), 
    319          {'attrib-starts': [('getLogEntries|0|', 
    320                              24)], 
    321           'code-line': "            msgList = text_file.read().split('\\n')"\ 
    322                        "\n", 
    323           'first-line': 29L, 
    324           'folded-linenos': [], 
    325           'sel-line': 52L, 
    326           'sel-line-start': 1613L, 
    327           'selection_end': 1613L, 
    328           'selection_start': 1613L, 
    329           'zoom': 0L}, 
    330          1564324057.330601], 
    331         [loc('activitylog_watcher.py'), 
    332          {'attrib-starts': [('getLogEntries|0|', 
    333                              42)], 
    334           'code-line': '        desiredFields = "Activity Log.,"+name+","+co'\ 
    335                        'de+","+msg\n', 
    336           'first-line': 33L, 
    337           'folded-linenos': [], 
    338           'sel-line': 55L, 
    339           'sel-line-start': 1666L, 
    340           'selection_end': 1728L, 
    341           'selection_start': 1728L, 
    342           'zoom': 0L}, 
    343          1564408367.809524], 
     212        1564408367.809524], 
    344213        [loc('cad_watcher.py'), 
    345214         {'attrib-starts': [('getLogEntries|0|', 
     
    431300          'selection_start': 1143L, 
    432301          'zoom': 0L}, 
    433          1564438185.449366]], 
     302         1564438185.449366], 
     303        [loc('logging_service.py'), 
     304         {'attrib-starts': [('getSimTime|0|', 
     305                             13)], 
     306          'code-line': '       print "Proceeding with previous time: ", toHM'\ 
     307                       'S(seconds)\n', 
     308          'first-line': 0L, 
     309          'folded-linenos': [], 
     310          'sel-line': 21L, 
     311          'sel-line-start': 649L, 
     312          'selection_end': 649L, 
     313          'selection_start': 649L, 
     314          'zoom': 0L}, 
     315         1564440773.252122], 
     316        [loc('activitylog_watcher.py'), 
     317         {'attrib-starts': [('getLogEntries|0|', 
     318                             42)], 
     319          'code-line': '        desiredFields = "Activity Log.,"+name+","+co'\ 
     320                       'de+" "+msg\n', 
     321          'first-line': 0L, 
     322          'folded-linenos': [], 
     323          'sel-line': 55L, 
     324          'sel-line-start': 1666L, 
     325          'selection_end': 1723L, 
     326          'selection_start': 1723L, 
     327          'zoom': 0L}, 
     328         1564453007.218601], 
     329        [loc('cad_watcher.py'), 
     330         {'attrib-starts': [('getLogEntries|0|', 
     331                             24)], 
     332          'code-line': '            print pathToLog + " missing: assuming re'\ 
     333                       'set."\n', 
     334          'first-line': 0L, 
     335          'folded-linenos': [], 
     336          'sel-line': 37L, 
     337          'sel-line-start': 1087L, 
     338          'selection_end': 1143L, 
     339          'selection_start': 1143L, 
     340          'zoom': 0L}, 
     341         1564453014.195405], 
     342        [loc('logging_service.py'), 
     343         {'attrib-starts': [('getSimTime|0|', 
     344                             13)], 
     345          'code-line': '       print "Proceeding with previous time: ", toHM'\ 
     346                       'S(seconds)\n', 
     347          'first-line': 0L, 
     348          'folded-linenos': [], 
     349          'sel-line': 21L, 
     350          'sel-line-start': 649L, 
     351          'selection_end': 649L, 
     352          'selection_start': 649L, 
     353          'zoom': 0L}, 
     354         1564453030.973979], 
     355        [loc('unknown:untitled-1.py'), 
     356         {'attrib-starts': [], 
     357          'code-line': '', 
     358          'first-line': 0L, 
     359          'folded-linenos': [], 
     360          'sel-line': 0L, 
     361          'sel-line-start': 0L, 
     362          'selection_end': 0L, 
     363          'selection_start': 0L, 
     364          'zoom': 0L}, 
     365         1564453042.242505], 
     366        [loc('logging_service.py'), 
     367         {'attrib-starts': [('getSimTime|0|', 
     368                             13)], 
     369          'code-line': '       print "Proceeding with previous time: ", toHM'\ 
     370                       'S(seconds)\n', 
     371          'first-line': 0L, 
     372          'folded-linenos': [], 
     373          'sel-line': 21L, 
     374          'sel-line-start': 649L, 
     375          'selection_end': 649L, 
     376          'selection_start': 649L, 
     377          'zoom': 0L}, 
     378         1564453047.692926], 
     379        [loc('test_logging_service.py'), 
     380         {'attrib-starts': [('test_toHMS|0|', 
     381                             0)], 
     382          'code-line': '    ', 
     383          'first-line': 0L, 
     384          'folded-linenos': [], 
     385          'sel-line': 3L, 
     386          'sel-line-start': 57L, 
     387          'selection_end': 61L, 
     388          'selection_start': 61L, 
     389          'zoom': 0L}, 
     390         1564453169.869372], 
     391        [loc('logging_service.py'), 
     392         {'attrib-starts': [('getSimTime|0|', 
     393                             13)], 
     394          'code-line': '       print "Proceeding with previous time: ", toHM'\ 
     395                       'S(seconds)\n', 
     396          'first-line': 0L, 
     397          'folded-linenos': [], 
     398          'sel-line': 21L, 
     399          'sel-line-start': 649L, 
     400          'selection_end': 649L, 
     401          'selection_start': 649L, 
     402          'zoom': 0L}, 
     403         1564453453.032643], 
     404        [loc('test_logging_service.py'), 
     405         {'attrib-starts': [('test_toHMS|0|', 
     406                             2)], 
     407          'code-line': '    ', 
     408          'first-line': 0L, 
     409          'folded-linenos': [], 
     410          'sel-line': 7L, 
     411          'sel-line-start': 194L, 
     412          'selection_end': 198L, 
     413          'selection_start': 198L, 
     414          'zoom': 0L}, 
     415         1564453867.007001], 
     416        [loc('test_logging_service.py'), 
     417         {'attrib-starts': [('test_toHMS|0|', 
     418                             2)], 
     419          'code-line': 'def test_toHMS():\n', 
     420          'first-line': 0L, 
     421          'folded-linenos': [], 
     422          'sel-line': 2L, 
     423          'sel-line-start': 35L, 
     424          'selection_end': 49L, 
     425          'selection_start': 39L, 
     426          'zoom': 0L}, 
     427         1564453872.826719], 
     428        [loc('logging_service.py'), 
     429         {'attrib-starts': [('getSimTime|0|', 
     430                             13)], 
     431          'code-line': '       print "Proceeding with previous time: ", toHM'\ 
     432                       'S(seconds)\n', 
     433          'first-line': 30L, 
     434          'folded-linenos': [], 
     435          'sel-line': 21L, 
     436          'sel-line-start': 649L, 
     437          'selection_end': 649L, 
     438          'selection_start': 649L, 
     439          'zoom': 0L}, 
     440         1564453933.136133], 
     441        [loc('test_logging_service.py'), 
     442         {'attrib-starts': [('test_toHMS|0|', 
     443                             2)], 
     444          'code-line': '    assert toHMS(3601) == "1:00:01"\n', 
     445          'first-line': 0L, 
     446          'folded-linenos': [], 
     447          'sel-line': 6L, 
     448          'sel-line-start': 158L, 
     449          'selection_end': 192L, 
     450          'selection_start': 192L, 
     451          'zoom': 0L}, 
     452         1564454686.591132]], 
    434453        20), 
    435         'current-loc': loc('logging_service.py'), 
     454        'current-loc': loc('cad_watcher.py'), 
    436455        'editor-state-list': [(loc('activitylog_watcher.py'), 
    437456                               {'attrib-starts': [('getLogEntries|0|', 
    438457        42)], 
    439458                                'code-line': '        desiredFields = "Activ'\ 
    440         'ity Log.,"+name+","+code+","+msg\n', 
    441                                 'first-line': 33L, 
     459        'ity Log.,"+name+","+code+" "+msg\n', 
     460                                'first-line': 0L, 
    442461                                'folded-linenos': [], 
    443462                                'sel-line': 55L, 
    444463                                'sel-line-start': 1666L, 
    445                                 'selection_end': 1728L, 
    446                                 'selection_start': 1728L, 
     464                                'selection_end': 1723L, 
     465                                'selection_start': 1723L, 
    447466                                'zoom': 0L}), 
    448467                              (loc('cad_watcher.py'), 
     
    451470                                'code-line': '            print pathToLog + '\ 
    452471        '" missing: assuming reset."\n', 
    453                                 'first-line': 32L, 
     472                                'first-line': 45L, 
    454473                                'folded-linenos': [], 
    455474                                'sel-line': 37L, 
     
    484503                                'code-line': '       print "Proceeding with '\ 
    485504        'previous time: ", toHMS(seconds)\n', 
    486                                 'first-line': 0L, 
     505                                'first-line': 30L, 
    487506                                'folded-linenos': [], 
    488507                                'sel-line': 21L, 
     
    490509                                'selection_end': 649L, 
    491510                                'selection_start': 649L, 
     511                                'zoom': 0L}), 
     512                              (loc('test_logging_service.py'), 
     513                               {'attrib-starts': [('test_toHMS|0|', 
     514        2)], 
     515                                'code-line': '    assert toHMS(3601) == "1:0'\ 
     516        '0:01"\n', 
     517                                'first-line': 0L, 
     518                                'folded-linenos': [], 
     519                                'sel-line': 6L, 
     520                                'sel-line-start': 158L, 
     521                                'selection_end': 192L, 
     522                                'selection_start': 192L, 
    492523                                'zoom': 0L}), 
    493524                              (loc('__main__.py'), 
     
    509540         loc('../../../config/logging_service.cfg'), 
    510541         loc('logging_service.py'), 
     542         loc('test_logging_service.py'), 
    511543         loc('__main__.py')]), 
    512544                               'open_files': [u'../../../config/logging_service.cfg', 
     
    514546        u'cms_watcher.py', 
    515547        u'activitylog_watcher.py', 
    516         u'cad_watcher.py', 
    517         u'logging_service.py']}, 
     548        u'logging_service.py', 
     549        u'test_logging_service.py', 
     550        u'cad_watcher.py']}, 
    518551        'saved_notebook_display': None, 
    519552        'split_percents': {0: 0.5}, 
     
    522555        'traversal_pos': ((0, 
    523556                           3), 
    524                           1564437523.022983), 
     557                          1564454637.847513), 
    525558        'user_data': {}}, 
    526559                 'saved_notebook_display': None, 
     
    530563                 'traversal_pos': ((0, 
    531564                                    4), 
    532                                    1564438041.344573), 
     565                                   1564454677.406196), 
    533566                 'user_data': {}}, 
    534567        'window-alloc': (29, 
     
    536569                         1197, 
    537570                         722)}]} 
    538 guimgr.recent-documents = [loc('logging_service.py'), 
    539                            loc('cad_watcher.py'), 
     571guimgr.recent-documents = [loc('cad_watcher.py'), 
     572                           loc('test_logging_service.py'), 
     573                           loc('logging_service.py'), 
    540574                           loc('activitylog_watcher.py'), 
    541575                           loc('__main__.py'), 
Note: See TracChangeset for help on using the changeset viewer.