apache/spark — pull request #3739 by JoshRosen (2014-12-19 01:48:03+00:00)
Title: [SPARK-4893] Add test fixture for resetting system properties after individual test runs

Several of our tests call System.setProperty (or test code which implicitly sets system properties) and don't always reset/clear the modified properties, which can create ordering dependencies between tests and cause hard-to-diagnose failures.

To address this, this PR introduces a `ResetSystemProperties` ScalaTest mixin class which uses `withFixture` to snapshot the system properties before individual tests and to automatically restore them on test completion / failure.

I've updated the Spark core test suites to use this and found several instances where we didn't properly clean up properties. I'd like to apply similar fixes to the other subprojects, too; I can't directly use the `ResetSystemProperties` class from Spark Core because it needs to be in a test JAR in order to compile against ScalaTest, and we don't have the build configured so that subprojects can depend on core's tests.