Github user JoshRosen commented on the pull request:
https://github.com/apache/spark/pull/3121#issuecomment-61928164
Here's another example of bad test fixture design: Spark SQL's
`TestSQLContext` is a global `SparkContext` instance so it can't easily be
started / stopped and is shared across multiple tests / suites:
```scala
/** A SQLContext that can be used for local testing. */
object TestSQLContext
extends SQLContext(
new SparkContext(
"local[2]",
"TestSQLContext",
new SparkConf().set("spark.sql.testkey", "true"))) {
/** Fewer partitions to speed up testing. */
override private[spark] def numShufflePartitions: Int =
getConf(SQLConf.SHUFFLE_PARTITIONS, "5").toInt
}
```
I'm going to refactor this into a proper testing trait,
`SharedLocalSQLContext`, that manages setup / teardown using BeforeAndAfterAll.
---
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]