コード例 #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"