def test_maven_discovery_plugin_scan_same_depth():
    """Test that the Maven discovery plugin finds two pom.xml files at the same depth."""
    mdp = MavenDiscoveryPlugin()
    package = Package('two_package', os.path.join(os.path.dirname(__file__),
                                                  'two_package'))
    mdp.scan(package, 'level')
    expected_top = [os.path.join('a', 'pom.xml'), os.path.join('b', 'pom.xml')]
    expected_top_fullpath = [os.path.join(package.path, filename)
                             for filename in expected_top]
    assert set(package['top_poms']) == set(expected_top_fullpath)
    assert set(package['all_poms']) == set(expected_top_fullpath)
Exemplo n.º 2
0
def test_maven_discovery_plugin_scan_with_exceptions():
    """Test that the Maven discovery plugin finds pom.xml files when exceptions are specified."""
    mdp = MavenDiscoveryPlugin()
    package = Package(
        "single_package",
        os.path.join(os.path.dirname(__file__), "single_package"))
    exceptions = Exceptions(
        os.path.join(os.path.dirname(__file__), "valid_exceptions.yaml"))
    mdp.scan(package, "level", exceptions)

    assert not package["top_poms"]
    assert not package["all_poms"]
Exemplo n.º 3
0
def test_maven_discovery_plugin_scan_same_depth():
    """Test that the Maven discovery plugin finds two pom.xml files at the same depth."""
    mdp = MavenDiscoveryPlugin()
    package = Package("two_package",
                      os.path.join(os.path.dirname(__file__), "two_package"))
    mdp.scan(package, "level")
    expected_top = [os.path.join("a", "pom.xml"), os.path.join("b", "pom.xml")]
    expected_top_fullpath = [
        os.path.join(package.path, filename) for filename in expected_top
    ]
    assert set(package["top_poms"]) == set(expected_top_fullpath)
    assert set(package["all_poms"]) == set(expected_top_fullpath)
def test_maven_discovery_plugin_scan_single():
    """Test that the Maven discovery plugin finds a single pom.xml."""
    mdp = MavenDiscoveryPlugin()
    package = Package('single_package', os.path.join(os.path.dirname(__file__),
                                                     'single_package'))
    mdp.scan(package, 'level')
    expected_top = ['pom.xml']
    # We have to add the path to each of the above...yuck
    expected_top_fullpath = [os.path.join(package.path, filename)
                             for filename in expected_top]
    # Neat trick to verify that two unordered lists are the same
    assert set(package['top_poms']) == set(expected_top_fullpath)
    assert set(package['all_poms']) == set(expected_top_fullpath)