Skip to content
Merged
Show file tree
Hide file tree
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
49 changes: 49 additions & 0 deletions .github/workflows/email-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Email Tests (Requires Postmark Credentials)

on:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Set up Python
run: uv python install 3.12

- name: Install dependencies
run: uv sync --group dev

- name: Check Postmark credentials
env:
POSTMARK_API_TOKEN: ${{ secrets.POSTMARK_API_TOKEN }}
SENDER_EMAIL: ${{ secrets.SENDER_EMAIL }}
run: |
if [ -z "$POSTMARK_API_TOKEN" ]; then
echo "Error: POSTMARK_API_TOKEN is not set in repository secrets"
echo "This workflow requires Postmark credentials to run email tests"
echo "Please add POSTMARK_API_TOKEN and SENDER_EMAIL to repository secrets"
exit 1
fi
if [ -z "$SENDER_EMAIL" ]; then
echo "Error: SENDER_EMAIL is not set in repository secrets"
exit 1
fi
echo "Postmark credentials are properly configured"

- name: Run email sending tests
env:
POSTMARK_API_TOKEN: ${{ secrets.POSTMARK_API_TOKEN }}
SENDER_EMAIL: ${{ secrets.SENDER_EMAIL }}
run: uv run pytest tests/ -v -m "flow"

- name: Run async email sending tests
env:
POSTMARK_API_TOKEN: ${{ secrets.POSTMARK_API_TOKEN }}
SENDER_EMAIL: ${{ secrets.SENDER_EMAIL }}
run: uv run pytest tests/test_tacomail_async.py -v -m "flow"
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint and Type Check

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Set up Python
run: uv python install 3.12

- name: Install dependencies
run: uv sync --group dev

- name: Run linter
run: uv run ruff check .
40 changes: 11 additions & 29 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: Basic Tests

on:
push:
Expand All @@ -9,39 +9,21 @@ on:
jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Set up Python
run: uv python install 3.12

- name: Install dependencies
run: uv sync --group dev

- name: Run linter
run: uv run ruff check .

- name: Check Postmark credentials
env:
POSTMARK_API_TOKEN: ${{ secrets.POSTMARK_API_TOKEN }}
SENDER_EMAIL: ${{ secrets.SENDER_EMAIL }}
run: |
if [ -z "$POSTMARK_API_TOKEN" ]; then
echo "Error: POSTMARK_API_TOKEN is not set in repository secrets"
exit 1
fi
if [ -z "$SENDER_EMAIL" ]; then
echo "Error: SENDER_EMAIL is not set in repository secrets"
exit 1
fi
echo "Postmark credentials are properly configured"

- name: Run tests
env:
POSTMARK_API_TOKEN: ${{ secrets.POSTMARK_API_TOKEN }}
SENDER_EMAIL: ${{ secrets.SENDER_EMAIL }}
run: uv run pytest tests/ -v

- name: Run basic tests (no email sending required)
run: uv run pytest tests/ -v -m "not flow"

- name: Run async basic tests
run: uv run pytest tests/test_tacomail_async.py -v -m "not flow"
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,6 @@ To receive emails, you can use either approach:
2. ✅ `tacomail create-session <email>` - Create session (REQUIRED)
3. ✅ `tacomail wait <email>` - Monitor inbox for incoming emails

### Benefits of create-with-session

The `create-with-session` command (and its short alias `new`) provides several advantages:

- **⚡ Faster workflow**: One command instead of two
- **🎯 Reduced errors**: No need to copy-paste email between commands
- **📋 Complete information**: Shows both email and session details at once
- **🔄 Works in both modes**: Supports both sync and async clients
- **🎨 Better UX**: Clear next steps displayed after creation
- **⚙️ Flexible options**: Still supports domain and username customization

### Common Workflows

**Workflow 1: Quick setup for testing**
Expand Down
1 change: 1 addition & 0 deletions tests/test_tacomail.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def test_fetch_empty_inbox(client: TacomailClient):
assert len(emails) == 0


@pytest.mark.flow
def test_email_sender_initialization():
sender = PostmarkEmailSender()
assert sender.api_token is not None
Expand Down
2 changes: 2 additions & 0 deletions tests/test_tacomail_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ async def test_delete_session_async(
await client.delete_session(username, domain)


@pytest.mark.flow
@pytest.mark.asyncio
async def test_wait_for_email_async(
client_generator: AsyncGenerator[AsyncTacomailClient, None],
Expand Down Expand Up @@ -81,6 +82,7 @@ async def test_wait_for_email_async(
assert received_email.body.text.strip() == test_body


@pytest.mark.flow
@pytest.mark.asyncio
async def test_wait_for_email_filtered_async(
client_generator: AsyncGenerator[AsyncTacomailClient, None],
Expand Down