예제 #1
0
def test_write_existing_conf(tmp, mocker):
    mocked_input = mocker.patch('mozregression.config.input')
    mocked_input.return_value = ""
    conf_path = os.path.join(tmp, 'conf.cfg')
    write_conf(conf_path)
    results = get_defaults(conf_path)
    assert results
    # write conf again
    write_conf(conf_path)
    # nothing changed
    assert results == get_defaults(conf_path)
    with open(conf_path) as f:
        # ensure we have comments
        assert "# ------ mozregression configuration file ------" in f.read()
예제 #2
0
def test_write_existing_conf(tmp, mocker):
    mocked_input = mocker.patch("__builtin__.raw_input")
    mocked_input.return_value = ""
    conf_path = os.path.join(tmp, "conf.cfg")
    write_conf(conf_path)
    results = get_defaults(conf_path)
    assert results
    # write conf again
    write_conf(conf_path)
    # nothing changed
    assert results == get_defaults(conf_path)
    with open(conf_path) as f:
        # ensure we have comments
        assert "# ------ mozregression configuration file ------" in f.read()
예제 #3
0
def test_write_conf(tmp, mocker, os_, bits, inputs, conf_dir_exists, results):
    mozinfo = mocker.patch('mozregression.config.mozinfo')
    mozinfo.os = os_
    mozinfo.bits = bits
    mocked_input = mocker.patch('__builtin__.raw_input')
    mocked_input.side_effect = inputs
    conf_path = os.path.join(tmp, 'conf.cfg')
    if not conf_dir_exists:
        mozfile.remove(conf_path)
    write_conf(conf_path)
    if 'persist' in results and results['persist'] is None:
        # default persist is base on the directory of the conf file
        results['persist'] = os.path.join(tmp, 'persist')
    conf = get_defaults(conf_path)
    for key in results:
        assert conf[key] == results[key]
    with open(conf_path) as f:
        # ensure we have comments
        assert "# ------ mozregression configuration file ------" in f.read()
예제 #4
0
def test_write_conf(tmp, mocker, os_, bits, inputs, conf_dir_exists, results):
    mozinfo = mocker.patch("mozregression.config.mozinfo")
    mozinfo.os = os_
    mozinfo.bits = bits
    mocked_input = mocker.patch("__builtin__.raw_input")
    mocked_input.side_effect = inputs
    conf_path = os.path.join(tmp, "conf.cfg")
    if not conf_dir_exists:
        mozfile.remove(conf_path)
    write_conf(conf_path)
    if "persist" in results and results["persist"] is None:
        # default persist is base on the directory of the conf file
        results["persist"] = os.path.join(tmp, "persist")
    conf = get_defaults(conf_path)
    for key in results:
        assert conf[key] == results[key]
    with open(conf_path) as f:
        # ensure we have comments
        assert "# ------ mozregression configuration file ------" in f.read()
예제 #5
0
파일: cli.py 프로젝트: zapion/mozregression
 def __call__(self, parser, namespace, values, option_string=None):
     write_conf(DEFAULT_CONF_FNAME)
     parser.exit()
예제 #6
0
파일: cli.py 프로젝트: mars-f/mozregression
 def __call__(self, parser, namespace, values, option_string=None):
     write_conf(DEFAULT_CONF_FNAME)
     parser.exit()