예제 #1
0
def test_perl_discovery_plugin_scan_valid():
    """Test that the Perl discovery plugin finds valid perl files."""
    pldp = PerlDiscoveryPlugin()
    package = Package(
        "valid_package", os.path.join(os.path.dirname(__file__), "valid_package")
    )
    pldp.scan(package, "level", None)
    expected = ["test.pl", os.path.join("ignore_this", "ignoreme.pl")]
    if pldp.file_command_exists():
        expected += ["oddextensionpl.source"]
    # We have to add the path to each of the above...yuck
    expected_fullpath = [os.path.join(package.path, filename) for filename in expected]
    # Neat trick to verify that two unordered lists are the same
    assert set(package["perl_src"]) == set(expected_fullpath)
def test_perl_discovery_plugin_scan_valid():
    """Test that the Perl discovery plugin finds valid perl files."""
    pldp = PerlDiscoveryPlugin()
    package = Package('valid_package', os.path.join(os.path.dirname(__file__),
                                                    'valid_package'))
    pldp.scan(package, 'level', None)
    expected = ['test.pl']
    if pldp.file_command_exists():
        expected += ['oddextensionpl.source']
    # We have to add the path to each of the above...yuck
    expected_fullpath = [os.path.join(package.path, filename)
                         for filename in expected]
    # Neat trick to verify that two unordered lists are the same
    assert set(package['perl_src']) == set(expected_fullpath)
예제 #3
0
def test_perl_discovery_plugin_scan_exceptions():
    """Test that the perl discovery plugin properly respects exceptions."""
    pldp = PerlDiscoveryPlugin()
    package = Package(
        "valid_package", os.path.join(os.path.dirname(__file__), "valid_package")
    )
    exceptions = Exceptions(os.path.join(os.path.dirname(__file__), "exceptions.yaml"))
    pldp.scan(package, "level", exceptions)
    expected_src = ["test.pl", "oddextensionpl.source"]
    # We have to add the path to each of the above...yuck
    expected_src_fullpath = [
        os.path.join(package.path, filename) for filename in expected_src
    ]
    # Neat trick to verify that two unordered lists are the same
    assert set(package["perl_src"]) == set(expected_src_fullpath)
예제 #4
0
def test_perl_discovery_plugin_no_file_cmd():
    """
    Test when file command does not exist.

    Test that files are not discovered with file command output if file
    command does not exist.
    """
    with modified_environ(PATH=""):
        pldp = PerlDiscoveryPlugin()
        package = Package(
            "valid_package", os.path.join(os.path.dirname(__file__), "valid_package")
        )
        pldp.scan(package, "level")
        expected = ["test.pl", os.path.join("ignore_this", "ignoreme.pl")]
        # We have to add the path to each of the above...yuck
        expected_fullpath = [
            os.path.join(package.path, filename) for filename in expected
        ]
        # Neat trick to verify that two unordered lists are the same
        assert set(package["perl_src"]) == set(expected_fullpath)