Exemple #1
0
def test_filter_mtf_justtests():
    """
    tests load configu and just tests there
    """
    out = filtertests(backend="mtf",
                      location=__TC_MTF_COMPOMENT,
                      linters=False,
                      tests=["*.py"],
                      tags=[],
                      relevancy="")
    print_debug(out)
    assert len(out) == 11
Exemple #2
0
def test_filter_mtf_filtered_tests_add():
    """
    tests load config with filters
    :return:
    """
    out = filtertests(backend="mtf",
                      location=__TC_MTF_COMPOMENT,
                      linters=False,
                      tests=["*.py"],
                      tags=["add"],
                      relevancy="")
    print_debug(out)
    assert len(out) == 6
Exemple #3
0
def test_filter_mtf_nothing():
    """
    use config what loads no tests
    :return:
    """
    out = filtertests(backend="mtf",
                      location=__TC_MTF_COMPOMENT,
                      linters=False,
                      tests=[],
                      tags=[],
                      relevancy="")
    print_debug(out)
    assert len(out) == 0
Exemple #4
0
def test_filter_mtf_justlintes():
    """
    test load just linter with simple config
    :return:
    """
    out = filtertests(backend="mtf",
                      location=__TC_MTF_COMPOMENT,
                      linters=True,
                      tests=[],
                      tags=[],
                      relevancy="")
    print_debug(out)
    assert len(out) > 20
Exemple #5
0
def test_general_config():
    """
    test loading general config and check number of tests, linters disabled
    :return:
    """
    out = (filtertests(backend=None,
                       location=__TC_GENERAL_CONF,
                       linters=False,
                       tests=[],
                       tags=[],
                       relevancy=""))
    print_debug(out)
    assert len(out) == 2
Exemple #6
0
def test_filter_general():
    """
    tests load config with filters, for general module
    :return:
    """
    out = filtertests(backend=None,
                      location=__TC_GENERAL_COMPONENT,
                      linters=False,
                      tests=[],
                      tags=[],
                      relevancy="")
    print_debug(out)
    assert len(out) == 6
Exemple #7
0
def test_mtf_config():
    """
    test real life example and check if proper tests were filtered based on config file
    :return:
    """
    out = filtertests(backend="mtf",
                      location=__TC_MTF_CONF,
                      linters=False,
                      tests=[],
                      tags=[],
                      relevancy="")
    tests = [x[SOURCE] for x in out]
    print_debug(tests)
    assert len(tests) == 6
    assert "Rem" not in " ".join(tests)
    assert "Add" in " ".join(tests)
    assert "DockerFileLint" in " ".join(tests)