unit testing

elsirya
New Contributor III
Currently I am creating unit tests for our ETL scripts although the test is not able to recognize sc (SparkContext).
Is there a way to mock SparkContext for a unit test?
 
Code being tested: df = spark.read.json(sc.parallelize([data]))
 
Error message received when running PyTest: NameError: name 'sc' is not defined