diff --git a/ci/environment.yml b/ci/environment.yml index abe3759d..ead5a844 100644 --- a/ci/environment.yml +++ b/ci/environment.yml @@ -10,4 +10,5 @@ dependencies: - black - pytest - pytest-asyncio + - anyio - cryptography diff --git a/conftest.py b/conftest.py index 0d3aa9cc..62ce53ab 100644 --- a/conftest.py +++ b/conftest.py @@ -26,6 +26,11 @@ import warnings +@pytest.fixture +def anyio_backend(): + return "asyncio" + + def pytest_addoption(parser): parser.addoption( "-E", diff --git a/dask_jobqueue/tests/test_job.py b/dask_jobqueue/tests/test_job.py index 497ceeb5..d98df656 100644 --- a/dask_jobqueue/tests/test_job.py +++ b/dask_jobqueue/tests/test_job.py @@ -21,7 +21,7 @@ def test_basic(Cluster): assert "127.0.0.1:12345" in job.job_script() -@pytest.mark.asyncio +@pytest.mark.anyio async def test_job(EnvSpecificCluster): job_cls = EnvSpecificCluster.job_cls async with Scheduler(port=0) as s: @@ -39,7 +39,7 @@ async def test_job(EnvSpecificCluster): assert time() < start + 10 -@pytest.mark.asyncio +@pytest.mark.anyio async def test_cluster(EnvSpecificCluster): job_cls = EnvSpecificCluster.job_cls async with JobQueueCluster( @@ -62,7 +62,7 @@ async def test_cluster(EnvSpecificCluster): assert time() < start + 10 -@pytest.mark.asyncio +@pytest.mark.anyio async def test_adapt(EnvSpecificCluster): job_cls = EnvSpecificCluster.job_cls async with JobQueueCluster( @@ -92,7 +92,7 @@ async def test_adapt(EnvSpecificCluster): assert not cluster.workers -@pytest.mark.asyncio +@pytest.mark.anyio async def test_adapt_parameters(EnvSpecificCluster): job_cls = EnvSpecificCluster.job_cls async with JobQueueCluster( @@ -205,7 +205,7 @@ def test_deprecation_header_skip(Cluster): assert "jobname" not in job_script -@pytest.mark.asyncio +@pytest.mark.anyio async def test_nworkers_scale(): async with LocalCluster( cores=2, memory="4GB", processes=2, asynchronous=True @@ -432,7 +432,7 @@ def test_deprecation_job_extra(Cluster): assert "old_param" in job_script -@pytest.mark.asyncio +@pytest.mark.anyio async def test_jobqueue_job_call(tmpdir, Cluster): async with Cluster(cores=1, memory="1GB", asynchronous=True) as cluster: path = tmpdir.join("test.py") diff --git a/dask_jobqueue/tests/test_jobqueue_core.py b/dask_jobqueue/tests/test_jobqueue_core.py index ceadd126..2ac6bf64 100644 --- a/dask_jobqueue/tests/test_jobqueue_core.py +++ b/dask_jobqueue/tests/test_jobqueue_core.py @@ -184,7 +184,7 @@ def test_cluster_has_cores_and_memory(Cluster): Cluster(cores=4) -@pytest.mark.asyncio +@pytest.mark.anyio async def test_config_interface(): net_if_addrs = psutil.net_if_addrs() interface = list(net_if_addrs.keys())[0] diff --git a/dask_jobqueue/tests/test_pbs.py b/dask_jobqueue/tests/test_pbs.py index 89db0f68..58f63789 100644 --- a/dask_jobqueue/tests/test_pbs.py +++ b/dask_jobqueue/tests/test_pbs.py @@ -378,7 +378,7 @@ def test_informative_errors(): assert "cores" in str(info.value) -@pytest.mark.asyncio +@pytest.mark.anyio async def test_adapt(loop): async with PBSCluster(cores=1, memory="1 GB", asynchronous=True) as cluster: cluster.adapt() diff --git a/setup.py b/setup.py index 988490d6..d8743df3 100755 --- a/setup.py +++ b/setup.py @@ -13,6 +13,7 @@ extras_require["test"] = [ "pytest", "pytest-asyncio", + "anyio", "cryptography", ]