示例#1
0
def test_remaining_args_doubledash():
    dc = DirectoryContext(test_config(), "/foo", "/foo")
    params = MbtParams(test_config(), dc)
    params.add_topic_arg()
    params.add_remaining_args()
    rargs = params.parse(["-t", "bar", "--", "-x", "-yz"]).remaining_args
    assert rargs == ["-x", "-yz"]
示例#2
0
def test_required_installation_error():
    dc = DirectoryContext(test_config(), "/foo",
                          "/foo/topics/whatever/5.7-some-build")
    params = MbtParams(test_config(), dc)
    params.add_installation_arg()
    with pytest.raises(SystemExit):
        params.parse([])
示例#3
0
def test_required_variant_short_invalid():
    dc = DirectoryContext(test_config(), "/foo", "/foo")
    params = MbtParams(test_config(), dc)
    params.add_variant_arg()
    with pytest.raises(SystemExit):
        params.parse(["-v", "some"])
示例#4
0
def test_required_variant_error():
    dc = DirectoryContext(test_config(), "/foo", "/foo")
    params = MbtParams(test_config(), dc)
    params.add_variant_arg()
    with pytest.raises(SystemExit):
        params.parse([])
示例#5
0
def test_variant():
    dc = DirectoryContext(test_config(), "/foo",
                          "/foo/topics/whatever/5.7-some-build")
    params = MbtParams(test_config(), dc)
    params.add_variant_arg()
    assert params.parse([]).variant == "some-build"
示例#6
0
def test_required_series_long_succeeds():
    dc = DirectoryContext(test_config(), "/foo", "/foo")
    params = MbtParams(test_config(), dc)
    params.add_series_arg()
    assert params.parse(["--series", "5.7"]).series == "5.7"
示例#7
0
def test_required_series_short_incorrect():
    dc = DirectoryContext(test_config(), "/foo", "/foo")
    params = MbtParams(test_config(), dc)
    params.add_series_arg()
    with pytest.raises(SystemExit):
        params.parse(["-s", "whatever"])
示例#8
0
def test_series():
    dc = DirectoryContext(test_config(), "/foo", "/foo/topics/whatever/5.7")
    params = MbtParams(test_config(), dc)
    params.add_series_arg()
    assert params.parse([]).series == "5.7"
示例#9
0
def test_required_topic_long_succeeds():
    dc = DirectoryContext(test_config(), "/foo", "/foo")
    params = MbtParams(test_config(), dc)
    params.add_topic_arg()
    assert params.parse(["--topic", "whatever"]).topic == "whatever"
示例#10
0
def test_topic():
    dc = DirectoryContext(test_config(), "/foo", "/foo/topics/whatever")
    params = MbtParams(test_config(), dc)
    params.add_topic_arg()
    assert params.parse([]).topic == "whatever"
示例#11
0
def test_boolean_arg_present():
    dc = DirectoryContext(test_config(), "/foo", "/foo")
    params = MbtParams(test_config(), dc)
    params.add_boolean_arg("bar")
    assert params.parse(["--bar"]).bar is True
示例#12
0
def test_required_installation_long_succeeds():
    dc = DirectoryContext(test_config(), "/foo",
                          "/foo/topics/whatever/5.7-some-build")
    params = MbtParams(test_config(), dc)
    params.add_installation_arg()
    assert params.parse(["--installation", "some"]).installation == "some"
示例#13
0
def test_installation_implies_everything_else():
    dc = DirectoryContext(test_config(), "/foo", "/foo")
    params = MbtParams(test_config(), dc)
    params.add_installation_arg()
    with pytest.raises(SystemExit):
        params.parse(["-i", "some-tag"])
示例#14
0
def test_installation():
    dc = DirectoryContext(test_config(), "/foo",
                          "/foo/topics/whatever/5.7-some-build-inst-some")
    params = MbtParams(test_config(), dc)
    params.add_installation_arg()
    assert params.parse([]).installation == "some"
示例#15
0
def test_required_variant_long_succeeds():
    dc = DirectoryContext(test_config(), "/foo", "/foo")
    params = MbtParams(test_config(), dc)
    params.add_variant_arg()
    assert params.parse(["--variant", "some-build"]).variant == "some-build"