Skip to content

Commit

Permalink
Fix spark setup problem and section to cleanup files created in data …
Browse files Browse the repository at this point in the history
…area
  • Loading branch information
pavlis committed Dec 4, 2023
1 parent 601dc33 commit d46fb3e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions python/tests/io/test_distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
wfdir = "python/tests/data/wf_filetestdata"

@pytest.fixture
def setup_module_environment(scope="module"):
def setup_environment():
if os.path.exists(wfdir):
raise Exception("test_distributed setup: scratch directory={} exists. Must be empty to run this test".format(wfdir))
else:
Expand All @@ -47,7 +47,7 @@ def setup_module_environment(scope="module"):
if os.path.exists(wfdir):
shutil.rmtree(wfdir)

@pytest.fixture(scope="module")
@pytest.fixture
def spark():
sc = SparkContext("local", "io_distributed_testing")
yield sc
Expand Down Expand Up @@ -413,7 +413,7 @@ def set_dir_dfile_ensemble(d):
("spark","wf_TimeSeries"),
("spark","wf_Seismogram")
])
def test_read_distributed_atomic(spark,atomic_time_series_generator,atomic_seismogram_generator,scheduler,collection):
def test_read_distributed_atomic(setup_environment,spark,atomic_time_series_generator,atomic_seismogram_generator,scheduler,collection):
"""
This function is run with multiple tests to test atomic read (mostly) and
limited writes with the io.distributed module. That is, read_distributed_data
Expand Down Expand Up @@ -622,7 +622,8 @@ def test_read_distributed_atomic(spark,atomic_time_series_generator,atomic_seism
("spark","wf_TimeSeries"),
("spark","wf_Seismogram")
])
def test_write_distributed_atomic(scheduler,
def test_write_distributed_atomic(setup_environment,
scheduler,
collection,
spark,
define_kill_one,
Expand Down Expand Up @@ -974,7 +975,7 @@ def get_srclist_by_tag(db,data_tag)->list:
("spark","wf_TimeSeries"),
("spark","wf_Seismogram")
])
def test_read_distributed_ensemble(spark,TimeSeriesEnsemble_generator,SeismogramEnsemble_generator,scheduler,collection):
def test_read_distributed_ensemble(setup_environment,spark,TimeSeriesEnsemble_generator,SeismogramEnsemble_generator,scheduler,collection):
print("Starting test with scheduler=",scheduler, " and collection=",collection)
if scheduler=="spark":
context=spark
Expand Down Expand Up @@ -1122,7 +1123,8 @@ def test_read_distributed_ensemble(spark,TimeSeriesEnsemble_generator,Seismogram
("spark","wf_TimeSeries"),
("spark","wf_Seismogram"),
])
def test_write_distributed_ensemble(scheduler,
def test_write_distributed_ensemble(setup_environment,
scheduler,
collection,
spark,
define_kill_one_member,
Expand Down

0 comments on commit d46fb3e

Please sign in to comment.