Skip to content
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

pytest-api test: fix ping server step #997

Merged
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update deprecated decorators
  • Loading branch information
odulcy-mindee committed Jul 26, 2022
commit 9049fd33e1b426849ed8d54443fd083838f92e2e
8 changes: 4 additions & 4 deletions api/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@
# This program is licensed under the Apache License version 2.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0.txt> for full license details.

import pytest
import pytest_asyncio
import requests
from httpx import AsyncClient

from app.main import app


@pytest.fixture(scope="session")
@pytest_asyncio.fixture(scope="session")
def mock_recognition_image(tmpdir_factory):
url = 'https://user-images.githubusercontent.com/76527547/117133599-c073fa00-ada4-11eb-831b-412de4d28341.jpeg'
return requests.get(url).content


@pytest.fixture(scope="session")
@pytest_asyncio.fixture(scope="session")
def mock_detection_image(tmpdir_factory):
url = 'https://user-images.githubusercontent.com/76527547/117319856-fc35bf00-ae8b-11eb-9b51-ca5aba673466.jpg'
return requests.get(url).content


@pytest.fixture(scope="function")
@pytest_asyncio.fixture(scope="function")
async def test_app_asyncio():
# for httpx>=20, follow_redirects=True (cf. https://github.com/encode/httpx/releases/tag/0.20.0)
async with AsyncClient(app=app, base_url="http://test") as ac:
Expand Down