Github user liancheng commented on a diff in the pull request:
https://github.com/apache/spark/pull/7971#discussion_r38748233
--- Diff: core/src/test/scala/org/apache/spark/SparkFunSuite.scala ---
@@ -44,5 +49,27 @@ private[spark] abstract class SparkFunSuite extends
FunSuite with Logging {
logInfo(s"\n\n===== FINISHED $shortSuiteName: '$testName' =====\n")
}
}
+ /**
+ * Generates a temporary path without creating the actual
file/directory, then pass it to `f`. If
+ * a file/directory is created there by `f`, it will be delete after `f`
returns.
+ *
+ * @todo Probably this method should be moved to a more general place
+ */
+ protected def withTempPath(f: File => Unit): Unit = {
+ val path = Utils.createTempDir()
+ path.delete()
+ try f(path) finally Utils.deleteRecursively(path)
+ }
+
+ /**
+ * Creates a temporary directory, which is then passed to `f` and will
be deleted after `f`
+ * returns.
+ *
+ * @todo Probably this method should be moved to a more general place
+ */
+ protected def withTempDir(f: File => Unit): Unit = {
+ val dir = Utils.createTempDir().getCanonicalFile
+ try f(dir) finally Utils.deleteRecursively(dir)
+ }
--- End diff --
Please remove the `withTempDir` method defined in
`OrcPartitionDiscoverySuite`. It's causing compilation error since an
`override` is missing there.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]