Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
daanvaningen committed Oct 3, 2024
1 parent 71dd37f commit c9604a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion tests/test_threedi_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ def test_init_nonexisting_version(config):
ThreediApi(config=config, version="v1")


def test_init_async(config):
@pytest.mark.asyncio
async def test_init_async(config):
api = ThreediApi(config=config, asynchronous=True)
assert isinstance(api._client, AsyncApiClient)
assert api.asynchronous
Expand Down
9 changes: 6 additions & 3 deletions tests/test_threedi_api_client_aio.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
from threedi_api_client.aio.threedi_api_client import ThreediApiClient


def test_init_threedi_api_client_from_env_file(tmpdir):
@pytest.mark.asyncio
async def test_init_threedi_api_client_from_env_file(tmpdir):
env_file = tmpdir / "env_file"
with open(str(env_file), "w") as f:
f.write("API_HOST=localhost:8000/v3.0\n")
Expand All @@ -12,15 +13,17 @@ def test_init_threedi_api_client_from_env_file(tmpdir):
ThreediApiClient(env_file=str(env_file))


def test_init_threedi_api_client_from_env_vars(monkeypatch):
@pytest.mark.asyncio
async def test_init_threedi_api_client_from_env_vars(monkeypatch):
monkeypatch.setenv("API_HOST", "localhost:8000/v3.0")
monkeypatch.setenv("API_USERNAME", "username")
monkeypatch.setenv("API_PASSWORD", "password")
with pytest.warns(UserWarning):
ThreediApiClient()


def test_init_threedi_api_client_from_config():
@pytest.mark.asyncio
async def test_init_threedi_api_client_from_config():
config = {
"API_HOST": "localhost:8000/v3.0",
"API_USERNAME": "username",
Expand Down

0 comments on commit c9604a0

Please sign in to comment.