Ejemplo n.º 1
0
def test_record_list():
    driver.get("http://127.0.0.1:8765/ProjectGlass/")
    # assert there are four records
    rows = driver.find_elements_by_tag_name('tr')
    assert_equal(len(rows), 4 + 1)  # first row is the header
    column_headers = [
        elem.text for elem in rows[0].find_elements_by_tag_name('th')
    ]
    # assert the labels are correct and that the reason and outcome fields are correct
    expected_content = substitute_labels([{
        'label': 0,
        'outcome': 'works fine',
        'reason': 'initial run',
        'version': '6038f9c...',
        'main': 'glass_sem_analysis.py'
    }, {
        'label': 1,
        'outcome': '',
        'reason': 'No filtering'
    }, {
        'label':
        2,
        'outcome':
        'The default colourmap is nicer',
        'reason':
        'Trying a different colourmap'
    }, {
        'label': 3,
        'outcome': '',
        'reason': 'Added labels to output',
        'version': '6038f9c...*'
    }])(utils.env)
    for row, expected in zip(rows[1:], reversed(expected_content)):
        cells = row.find_elements_by_tag_name('td')
        label = cells[0].text
        assert_equal(row.get_attribute('id'), label)
        actual = dict((key.lower(), cell.text)
                      for key, cell in zip(column_headers, cells))
        assert_dict_contains_subset(expected, actual)
Ejemplo n.º 2
0
  assert_in_output, expected_short_list),
 (
     "Review previous computations in detail",
     "smt list -l",
     assert_records,
     substitute_labels([
         {
             'label': 0,
             'executable_name': 'Python',
             'outcome': 'works fine',
             'reason': 'initial run',
             'version': '6038f9c500d1',
             'vcs': 'Mercurial',
             'script_arguments': '<parameters> MV_HFV_012.jpg',
             'main_file': 'glass_sem_analysis.py'
         },  # TODO: add checking of parameters
         {
             'label': 1,
             'outcome': '',
             'reason': 'No filtering'
         },
         {
             'label': 2,
             'outcome': 'The default colourmap is nicer',
             'reason': 'Trying a different colourmap'
         },
     ])),
 # ("Filter the output of ``smt list`` based on tag",
 #  "smt list mytag",
 #  #assert(list is correct)
 # ),
 # ("Export Sumatra records as JSON.",
Ejemplo n.º 3
0
  assert_label_equal, "example_label"),
 ("Change parameters from the command line",
  "smt run -r 'Trying a different colourmap' default_parameters MV_HFV_012.jpg phases_colourmap=hot"),  # assert(results have changed)
 ("Add another comment",
  "smt comment 'The default colourmap is nicer'"),  #TODO  add a comment to an older record (e.g. this colourmap is nicer than 'hot')")
 ("Add tags on the command line",
  build_command("smt tag mytag {0} {1}", "labels")),
 ("Review previous computations - get a list of labels",
  "smt list",
  assert_in_output, expected_short_list),
 ("Review previous computations in detail",
  "smt list -l",
  assert_records, substitute_labels([
      {'label': 0, 'executable_name': 'Python', 'outcome': 'works fine', 'reason': 'initial run',
       'version': '6038f9c500d1', 'vcs': 'Mercurial', 'script_arguments': '<parameters> MV_HFV_012.jpg',
       'main_file': 'glass_sem_analysis.py'},   # TODO: add checking of parameters
      {'label': 1, 'outcome': '', 'reason': 'No filtering'},
      {'label': 2, 'outcome': 'The default colourmap is nicer', 'reason': 'Trying a different colourmap'},
  ])),
 # ("Filter the output of ``smt list`` based on tag",
 #  "smt list mytag",
 #  #assert(list is correct)
 # ),
 # ("Export Sumatra records as JSON.",
 #  "smt export",
 #  assert_file_exists, ".smt/records_export.json"),
 # ("Change to a local record store",
 #  "smt configure --store=sumatra.sqlite"),
 # ("Check the list of labels is unchanged",
 #  "smt list",
 #  assert_in_output, expected_short_list),
Ejemplo n.º 4
0
     "smt run -r 'Added labels to output' default_parameters MV_HFV_012.jpg"),  # assert(output has changed as expected)
    #TODO: make another change to the Python script
    ("Change configuration to store diff",
     "smt configure --on-changed=store-diff"),
    ("Run with store diff",
     "smt run -r 'made a change' default_parameters MV_HFV_012.jpg"),  # assert(code runs, stores diff)
    ("Review previous computations - get a list of labels",
     "smt list",
     assert_in_output, expected_short_list),
    ("Review previous computations in detail",
     "smt list -l",
     assert_records, substitute_labels([
         {'label': 0, 'executable_name': 'Python', 'outcome': 'works fine', 'reason': 'initial run',
          'version': 'a98585eddfc7', 'vcs': 'Mercurial', 'script_args': '<parameters> MV_HFV_012.jpg',
          'main': 'glass_sem_analysis.py'},   # TODO: add checking of parameters
         {'label': 1, 'outcome': '', 'reason': 'No filtering'},
         {'label': 2, 'outcome': 'The default colourmap is nicer', 'reason': 'Trying a different colourmap'},
         {'label': 3, 'outcome': '', 'reason': 'Added labels to output'},
         {'label': 4, 'outcome': '', 'reason': 'made a change'},  # TODO: add checking of diff
     ])),
    ("Filter the output of ``smt list`` based on tag",
     "smt list mytag",
     #assert(list is correct)
    ),
    ("Export Sumatra records as JSON.",
     "smt export",
     assert_file_exists, ".smt/records_export.json"),
]


def test_all():