                 return true
             }
           #endif
-            let product = Product(name: "\(self.name)Tests", type: .Test, modules: testModules)
+            let product = Product(name: package.name + "Tests", type: .Test, modules: testModules)
             products.append(product)
         }
 


        return products
    }
}

extension Package {
    func shouldConsiderDirectory(_ path: AbsolutePath) -> Bool {
        let base = path.basename.lowercased()
        if base == "tests" { return false }
        if base == "include" { return false }
        if base.hasSuffix(".xcodeproj") { return false }
        if base.hasSuffix(".playground") { return false }
        if base.hasPrefix(".") { return false }  // eg .git
        if excludedPaths.contains(path) { return false }
        if path == packagesDirectory { return false }
        if !path.asString.isDirectory { return false }
        return true
    }

    private var packagesDirectory: AbsolutePath {
        return path.appending("Packages")
    }

    var excludedPaths: [AbsolutePath] {
        return manifest.package.exclude.map { self.path.appending(RelativePath($0)) }
    }
    
    private var pkgConfigPath: RelativePath? {
        guard let pkgConfig = manifest.package.pkgConfig else { return nil }
        return RelativePath(pkgConfig)
    }
}

extension Package {
    fileprivate func testModules(modules: [Module]) throws -> [Module] {
        let testsPath = self.path.appending("Tests")
        
        // Don't try to walk Tests if it is in excludes.
        if testsPath.asString.isDirectory && self.excludedPaths.contains(testsPath) { return [] }

        // Create the test modules
        let testModules = try walk(testsPath, recursively: false).filter(shouldConsiderDirectory).flatMap { dir in

            modules = try maybeModules.map { path in
                let name: String
                if path == srcroot {
                    name = package.name
                } else {
                    name = path.basename
                }
