With this test file test_leaky_state.py:
import spylon.spark.launcher as sparklauncher
import os
def test_set_spark_property():
c = sparklauncher.SparkConfiguration()
c.driver_memory = "4g"
def test_spark_driver_memory():
c = sparklauncher.SparkConfiguration()
c.conf.spark.driver.memory = "5g"
c._set_environment_variables()
assert '--driver-memory 5g' in os.environ['PYSPARK_SUBMIT_ARGS']
If I run test_spark_driver_memory by itself, it passes just fine:
$ python run_tests.py tests/test_leaky_state.py -k driver -v
========================================================================================================================================================================= test session starts =========================================================================================================================================================================
platform darwin -- Python 3.5.3, pytest-3.0.7, py-1.4.33, pluggy-0.4.0
rootdir: /Users/edill/dev/maxpoint/github/spylon, inifile:
collected 2 items
tests/test_leaky_state.py::test_spark_driver_memory PASSED
========================================================================================================================================================================= 1 tests deselected ==========================================================================================================================================================================
=============================================================================================================================================================== 1 passed, 1 deselected in 0.29 seconds ================================================================================================================================================================
Name Stmts Miss Cover
---------------------------------------------------
spylon/__init__.py 4 0 100%
spylon/_version.py 261 143 45%
spylon/common.py 62 40 35%
spylon/spark/__init__.py 4 0 100%
spylon/spark/launcher.py 286 126 56%
spylon/spark/progress.py 76 65 14%
spylon/spark/yarn_launcher.py 144 119 17%
tests/test_leaky_state.py 10 2 80%
---------------------------------------------------
TOTAL 847 495 42%
But if I run the two of these together, notably with test_set_spark_priority first, then test_spark_driver_memory fails
$ python run_tests.py tests/test_leaky_state.py -v
========================================================================================================================================================================= test session starts =========================================================================================================================================================================
platform darwin -- Python 3.5.3, pytest-3.0.7, py-1.4.33, pluggy-0.4.0 -- /Users/edill/miniconda/envs/spylon/bin/python
cachedir: .cache
rootdir: /Users/edill/dev/maxpoint/github/spylon, inifile:
collected 2 items
tests/test_leaky_state.py::test_set_spark_property PASSED
tests/test_leaky_state.py::test_spark_driver_memory FAILED
============================================================================================================================================================================== FAILURES ===============================================================================================================================================================================
______________________________________________________________________________________________________________________________________________________________________ test_spark_driver_memory _______________________________________________________________________________________________________________________________________________________________________
def test_spark_driver_memory():
c = sparklauncher.SparkConfiguration()
c.conf.spark.driver.memory = "5g"
c._set_environment_variables()
> assert '--driver-memory 5g' in os.environ['PYSPARK_SUBMIT_ARGS']
E AssertionError: assert '--driver-memory 5g' in '--driver-memory 4g pyspark-shell'
tests/test_leaky_state.py:12: AssertionError
================================================================================================================================================================= 1 failed, 1 passed in 0.34 seconds ==================================================================================================================================================================
Name Stmts Miss Cover
---------------------------------------------------
spylon/__init__.py 4 0 100%
spylon/_version.py 261 143 45%
spylon/common.py 62 40 35%
spylon/spark/__init__.py 4 0 100%
spylon/spark/launcher.py 286 124 57%
spylon/spark/progress.py 76 65 14%
spylon/spark/yarn_launcher.py 144 119 17%
tests/test_leaky_state.py 10 0 100%
---------------------------------------------------
TOTAL 847 491 42%
With this test file
test_leaky_state.py:If I run test_spark_driver_memory by itself, it passes just fine:
But if I run the two of these together, notably with
test_set_spark_priorityfirst, thentest_spark_driver_memoryfails