Github user ueshin commented on a diff in the pull request: https://github.com/apache/spark/pull/22762#discussion_r226266575 --- Diff: python/pyspark/sql/tests.py --- @@ -225,6 +225,55 @@ def sql_conf(self, pairs): else: self.spark.conf.set(key, old_value) + @contextmanager + def database(self, *databases): + """ + A convenient context manager to test with some specific databases. This drops the given + databases if exist and sets current database to "default" when it exits. + """ + assert hasattr(self, "spark"), "it should have 'spark' attribute, having a spark session." + + if len(databases) == 1 and isinstance(databases[0], (list, set)): --- End diff -- Sure, I'll remove it.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org