Ejemplo n.º 1
0
def test_load_testvars_throws_expected_errors(mach_parsed_kwargs):
    mach_parsed_kwargs['testvars'] = ['some_bad_path.json']
    runner = MarionetteTestRunner(**mach_parsed_kwargs)
    with pytest.raises(IOError) as io_exc:
        runner._load_testvars()
    assert 'does not exist' in io_exc.value.message
    with patch('os.path.exists', return_value=True):
        with patch('__builtin__.open', mock_open(read_data='[not {valid JSON]')):
            with pytest.raises(Exception) as json_exc:
                runner._load_testvars()
    assert 'not properly formatted' in json_exc.value.message
Ejemplo n.º 2
0
def test_load_testvars_throws_expected_errors(mach_parsed_kwargs):
    mach_parsed_kwargs['testvars'] = ['some_bad_path.json']
    runner = MarionetteTestRunner(**mach_parsed_kwargs)
    with pytest.raises(IOError) as io_exc:
        runner._load_testvars()
    assert 'does not exist' in io_exc.value.message
    with patch('os.path.exists', return_value=True):
        with patch('__builtin__.open', mock_open(read_data='[not {valid JSON]')):
            with pytest.raises(Exception) as json_exc:
                runner._load_testvars()
    assert 'not properly formatted' in json_exc.value.message
Ejemplo n.º 3
0
def test_load_testvars_throws_expected_errors(mach_parsed_kwargs):
    mach_parsed_kwargs["testvars"] = ["some_bad_path.json"]
    runner = MarionetteTestRunner(**mach_parsed_kwargs)
    with pytest.raises(IOError) as io_exc:
        runner._load_testvars()
    assert "does not exist" in str(io_exc.value)
    with patch("os.path.exists", return_value=True):
        with patch("__builtin__.open", mock_open(read_data="[not {valid JSON]")):
            with pytest.raises(Exception) as json_exc:
                runner._load_testvars()
    assert "not properly formatted" in str(json_exc.value)