I have mine set up so that I can run python tests by right-clicking. I do have to compile from the command line first, though – it’s possible to add a gradle task to be done before the python test, but that wastes many seconds.
- Ensure that your Python interpreter is set up correctly.
cmd ; > modules
can bring up the module menu. - From the top menu, go to
Run > Edit Configurations
- From the left menu, navitage to
Defaults > Python tests > Unittests
- edit your default to look like this, and hit save:
The environment variable hidden for me is
PYTHONPATH=$PYTHONPATH:/Users/tpoterba/spark-2.0.2-bin-hadoop2.7//python:/Users/tpoterba/spark-2.0.2-bin-hadoop2.7//python/lib/py4j-0.10.3-src.zip
We need this to add py4j and pyspark to the python path.