Skip to content

Commit 4e4de39

Browse files
change dask port to non default value + change unit test to a class fixture
1 parent 2f87641 commit 4e4de39

File tree

2 files changed

+34
-37
lines changed

2 files changed

+34
-37
lines changed

test/test-scheduler.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"type": "Scheduler",
33
"id": "Scheduler-bb130e13-812d-405b-965e-b9789d411850",
4-
"address": "tcp://127.0.0.1:8786",
4+
"address": "tcp://127.0.0.1:4242",
55
"services": {
66
"dashboard": 8787
77
},

test/test_deisa.py

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -187,43 +187,40 @@ def generate_data(self, array_name: str, iteration: int, send_order_fn=None) ->
187187
return global_data
188188

189189

190-
@pytest.fixture(scope="session")
191-
def env_setup_tcp_cluster():
192-
cluster = LocalCluster(n_workers=0, threads_per_worker=1, processes=True, host='127.0.0.1', scheduler_port=8786)
193-
yield cluster
194-
cluster.close()
195-
196-
197-
def test_deisa_ctor_client(env_setup_tcp_cluster):
198-
cluster = env_setup_tcp_cluster
199-
client = Client(cluster)
200-
deisa = Deisa(client, mpi_comm_size=0, nb_workers=0)
201-
assert deisa.client is not None, "Deisa should not be None"
202-
assert deisa.client.scheduler.address == cluster.scheduler_address, "Client should be the same as scheduler"
203-
deisa.close()
204-
205-
206-
def test_deisa_ctor_str(env_setup_tcp_cluster):
207-
cluster = env_setup_tcp_cluster
208-
deisa = Deisa('tcp://127.0.0.1:8786', mpi_comm_size=0, nb_workers=0)
209-
assert deisa.client is not None, "Deisa should not be None"
210-
assert deisa.client.scheduler.address == cluster.scheduler_address, "Client should be the same as scheduler"
211-
deisa.close()
212-
213-
214-
def test_deisa_ctor_scheduler_file(env_setup_tcp_cluster):
215-
cluster = env_setup_tcp_cluster
216-
f = os.path.abspath(os.path.dirname(__file__)) + os.path.sep + 'test-scheduler.json'
217-
deisa = Deisa(f, mpi_comm_size=0, nb_workers=0)
218-
assert deisa.client is not None, "Deisa should not be None"
219-
assert deisa.client.scheduler.address == cluster.scheduler_address, "Client should be the same as scheduler"
220-
deisa.close()
221-
222-
223-
def test_deisa_ctor_scheduler_file_error():
224-
with pytest.raises(ValueError) as e:
225-
f = os.path.abspath(os.path.dirname(__file__)) + os.path.sep + 'test-scheduler-error.json'
190+
class TestDeisaCtor:
191+
@pytest.fixture(scope="class")
192+
def env_setup_tcp_cluster(self):
193+
cluster = LocalCluster(n_workers=0, threads_per_worker=1, processes=True, host='127.0.0.1', scheduler_port=4242)
194+
yield cluster
195+
cluster.close()
196+
197+
def test_deisa_ctor_client(self, env_setup_tcp_cluster):
198+
cluster = env_setup_tcp_cluster
199+
client = Client(cluster)
200+
deisa = Deisa(client, mpi_comm_size=0, nb_workers=0)
201+
assert deisa.client is not None, "Deisa should not be None"
202+
assert deisa.client.scheduler.address == cluster.scheduler_address, "Client should be the same as scheduler"
203+
deisa.close()
204+
205+
def test_deisa_ctor_str(self, env_setup_tcp_cluster):
206+
cluster = env_setup_tcp_cluster
207+
deisa = Deisa('tcp://127.0.0.1:4242', mpi_comm_size=0, nb_workers=0)
208+
assert deisa.client is not None, "Deisa should not be None"
209+
assert deisa.client.scheduler.address == cluster.scheduler_address, "Client should be the same as scheduler"
210+
deisa.close()
211+
212+
def test_deisa_ctor_scheduler_file(self, env_setup_tcp_cluster):
213+
cluster = env_setup_tcp_cluster
214+
f = os.path.abspath(os.path.dirname(__file__)) + os.path.sep + 'test-scheduler.json'
226215
deisa = Deisa(f, mpi_comm_size=0, nb_workers=0)
216+
assert deisa.client is not None, "Deisa should not be None"
217+
assert deisa.client.scheduler.address == cluster.scheduler_address, "Client should be the same as scheduler"
218+
deisa.close()
219+
220+
def test_deisa_ctor_scheduler_file_error(self):
221+
with pytest.raises(ValueError) as e:
222+
f = os.path.abspath(os.path.dirname(__file__)) + os.path.sep + 'test-scheduler-error.json'
223+
deisa = Deisa(f, mpi_comm_size=0, nb_workers=0)
227224

228225

229226
@pytest.fixture(scope="session")

0 commit comments

Comments
 (0)