Skip to content

Commit

Permalink
fix testing without mangum; fix docker
Browse files Browse the repository at this point in the history
  • Loading branch information
Byczong committed Jan 2, 2025
1 parent f8f8701 commit eda136b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/namerank-python-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

- name: Install dependencies
working-directory: ./apps/api.namerank.io
run: poetry install
run: poetry install --extras "lambda"

- name: Run tests
working-directory: ./apps/api.namerank.io
Expand Down
2 changes: 1 addition & 1 deletion apps/api.namerank.io/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ WORKDIR /app
RUN yum install gcc -y
COPY pyproject.toml poetry.lock LICENSE README.md ./
COPY namerank ./namerank/
RUN pip install --no-cache-dir .[namerank]
RUN pip install --no-cache-dir .[lambda]
CMD [ "namerank.root_api.handler" ]
1 change: 0 additions & 1 deletion apps/api.namerank.io/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ lambda = ["mangum"]

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.0"

uvicorn = { extras = ["standard"], version = "^0.23.2" }
pytest-asyncio = "^0.21.1"
pytest-cov = "^4.1.0"
Expand Down
7 changes: 7 additions & 0 deletions apps/api.namerank.io/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
from nameguard.utils import MAX_INSPECTED_NAME_CHARACTERS


# if mangum is not installed, do not run the api tests
try:
import mangum # noqa: F401
except ImportError:
pytest.skip('mangum is not installed, skipping api tests', allow_module_level=True)


@pytest.fixture(scope='module')
def test_client():
with mock_static_property():
Expand Down

0 comments on commit eda136b

Please sign in to comment.