Skip to content

Replace pytest-asyncio with anyio #655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/environment.yml
Original file line number Diff line number Diff line change
@@ -10,4 +10,5 @@ dependencies:
- black
- pytest
- pytest-asyncio
- anyio
- cryptography
5 changes: 5 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -26,6 +26,11 @@
import warnings


@pytest.fixture
def anyio_backend():
return "asyncio"


def pytest_addoption(parser):
parser.addoption(
"-E",
12 changes: 6 additions & 6 deletions dask_jobqueue/tests/test_job.py
Original file line number Diff line number Diff line change
@@ -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")
2 changes: 1 addition & 1 deletion dask_jobqueue/tests/test_jobqueue_core.py
Original file line number Diff line number Diff line change
@@ -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]
2 changes: 1 addition & 1 deletion dask_jobqueue/tests/test_pbs.py
Original file line number Diff line number Diff line change
@@ -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()
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@
extras_require["test"] = [
"pytest",
"pytest-asyncio",
"anyio",
"cryptography",
]