Ejemplo n.º 1
0
def test_diag_check():
    details = "tests/data/device_details.yaml"
    version = "fw: v0.17-27-ge2c1aac\nhdl: v0.13-rc0\n"
    assert d.check_diagnostics(details, version)
    version = "fw: v0.17-27-deadbeef\nhdl: v0.13-rc0\n"
    assert not d.check_diagnostics(details, version)
    version = "fw: v0.17-27-ge2c1aac\nhdl: v0.13-defecated\n"
    assert not d.check_diagnostics(details, version)
    with pytest.raises(Exception):
        assert not d.check_diagnostics(details, None)
Ejemplo n.º 2
0
def test_diag_check():
    details = 'tests/data/device_details.yaml'
    version = 'fw: v0.17-27-ge2c1aac\nhdl: v0.13-rc0\n'
    assert d.check_diagnostics(details, version)
    version = 'fw: v0.17-27-deadbeef\nhdl: v0.13-rc0\n'
    assert not d.check_diagnostics(details, version)
    version = 'fw: v0.17-27-ge2c1aac\nhdl: v0.13-defecated\n'
    assert not d.check_diagnostics(details, version)
    with pytest.raises(Exception):
        assert not d.check_diagnostics(details, None)
def main():
  import os, sys
  args = get_args()
  diagnostics_filename = args.diagnostics_filename[0]
  assert os.path.exists(diagnostics_filename), \
    "Your hovercraft is full of fail, %s does not exist!" % diagnostics_filename
  version_filename = args.version_filename[0]
  assert os.path.exists(version_filename), \
    "Your hovercraft is full of fail, %s does not exist!" % version_filename
  version = open(version_filename, 'r+').read()
  if not d.check_diagnostics(diagnostics_filename, version):
    sys.exit(1)