This causes an ugly exception instead of showing an explanation message, and most importantly even prevents the fixture from working on spark 2.0 where it should be available.
the spark version can be read from sparkContext.version in older versions but that requires an instances of sparkContext to be created which is not the case here.
Instead I went for a simpler check to fix the issue: catch the ImportError in old spark versions and display a more helpful message.
Hi again @malexer ... Thanks for releasing a new version of
pytest-spark
so quickly!However I found a problem in the version check code I added in the
spark_session
fixture.pyspark.__version__
is only defined from v2.1 onwards... 😞This causes an ugly exception instead of showing an explanation message, and most importantly even prevents the fixture from working on spark 2.0 where it should be available.
the spark version can be read from
sparkContext.version
in older versions but that requires an instances ofsparkContext
to be created which is not the case here.Instead I went for a simpler check to fix the issue: catch the
ImportError
in old spark versions and display a more helpful message.Sorry about that!