Skip to content

[NOT-491] Skip live SDK tests without NOTTE_API_KEY#860

Open
HUAN2022A wants to merge 1 commit into
nottelabs:mainfrom
HUAN2022A:fix/skip-live-sdk-tests-without-api-key
Open

[NOT-491] Skip live SDK tests without NOTTE_API_KEY#860
HUAN2022A wants to merge 1 commit into
nottelabs:mainfrom
HUAN2022A:fix/skip-live-sdk-tests-without-api-key

Conversation

@HUAN2022A

@HUAN2022A HUAN2022A commented Jul 12, 2026

Copy link
Copy Markdown

Summary

  • add a shared require_notte_api_key pytest fixture that skips live API tests when NOTTE_API_KEY is missing
  • mark SDK tests that construct NotteClient() and call live Notte API endpoints with that fixture

Fixes #859

Test plan

uv run pytest -q tests/sdk/test_list.py::test_simple_listing tests/sdk/test_replay_frames.py::test_sdk_screenshots tests/sdk/test_validator.py::test_validator_message_received

Result without NOTTE_API_KEY configured:

3 skipped

Summary by CodeRabbit

  • Tests
    • Live API tests now run only when the required API key is available.
    • Tests automatically skip when the API key is not configured, avoiding failures in environments without live API access.

Linear: NOT-491 https://linear.app/nottelabsinc/issue/NOT-491/notte-pr-860-skip-live-sdk-tests-without-notte-api-key

@greptile-apps

greptile-apps Bot commented Jul 12, 2026

Copy link
Copy Markdown

PR author is not in the allowed authors list.

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Adds a require_notte_api_key pytest fixture that skips tests when NOTTE_API_KEY is absent. The listing, replay frames, and validator SDK tests now request this fixture while retaining their existing test logic.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR adds the skip fixture and applies it to the three live SDK tests named in issue #859.
Out of Scope Changes check ✅ Passed The changes are limited to the fixture and the specific SDK tests needed to avoid failures without API credentials.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: skipping live SDK tests when NOTTE_API_KEY is missing.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/conftest.py`:
- Line 57: Update the NOTTE_API_KEY availability check in the test setup to
treat both missing and empty or whitespace-only values as unavailable, using a
truthiness or stripped-value check so tests skip before making API calls.
- Around line 55-58: Update the require_notte_api_key fixture to load
environment variables from .env before checking NOTTE_API_KEY, using the
existing dotenv utility/import; preserve the current skip behavior when the key
remains unavailable.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4454e2a2-b857-40d0-ab33-17844b595139

📥 Commits

Reviewing files that changed from the base of the PR and between 8f3df6a and 60ebca2.

📒 Files selected for processing (4)
  • tests/conftest.py
  • tests/sdk/test_list.py
  • tests/sdk/test_replay_frames.py
  • tests/sdk/test_validator.py

Comment thread tests/conftest.py
Comment on lines +55 to +58
@pytest.fixture
def require_notte_api_key():
if os.getenv("NOTTE_API_KEY") is None:
pytest.skip("NOTTE_API_KEY is required for live Notte API tests")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check whether load_dotenv is already called in conftest.py before the fixture,
# and whether os and dotenv are imported.

# Search for load_dotenv calls in conftest.py
rg -n 'load_dotenv' tests/conftest.py

# Check imports for os and dotenv
rg -n '^import os|^from dotenv|^from notte' tests/conftest.py

# Check if other test files also call load_dotenv inside the test body
rg -n 'load_dotenv' tests/sdk/test_replay_frames.py tests/sdk/test_validator.py

Repository: nottelabs/notte

Length of output: 165


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== tests/conftest.py =="
wc -l tests/conftest.py
cat -n tests/conftest.py | sed -n '1,140p'

echo
echo "== load_dotenv references in tests/ =="
rg -n 'load_dotenv|NOTTE_API_KEY|require_notte_api_key' tests

echo
echo "== files that mention dotenv loading outside tests/ =="
rg -n 'load_dotenv|dotenv' .

Repository: nottelabs/notte

Length of output: 21594


Load .env before checking NOTTE_API_KEY
require_notte_api_key runs before any per-test load_dotenv() call, so tests like tests/sdk/test_list.py can be skipped even when the key exists in .env. Call load_dotenv() in the fixture or move dotenv loading to session startup.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/conftest.py` around lines 55 - 58, Update the require_notte_api_key
fixture to load environment variables from .env before checking NOTTE_API_KEY,
using the existing dotenv utility/import; preserve the current skip behavior
when the key remains unavailable.

Comment thread tests/conftest.py

@pytest.fixture
def require_notte_api_key():
if os.getenv("NOTTE_API_KEY") is None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Consider checking for empty-string API key values.

os.getenv("NOTTE_API_KEY") returns "" (not None) when the variable is set but empty. The test won't skip in that case but will likely fail at the API call. Consider using a truthiness check or strip.

🛡️ Proposed fix
-    if os.getenv("NOTTE_API_KEY") is None:
+    if not os.getenv("NOTTE_API_KEY"):
         pytest.skip("NOTTE_API_KEY is required for live Notte API tests")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if os.getenv("NOTTE_API_KEY") is None:
if not os.getenv("NOTTE_API_KEY"):
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/conftest.py` at line 57, Update the NOTTE_API_KEY availability check in
the test setup to treat both missing and empty or whitespace-only values as
unavailable, using a truthiness or stripped-value check so tests skip before
making API calls.

@2027-evals

2027-evals Bot commented Jul 12, 2026

Copy link
Copy Markdown

⚠️ Couldn't find a preview deployment for commit 60ebca2 after 10 minutes.

2027 auto-runs evals against preview deployments of your docs. To enable this, install one of:

  • Mintlify — if you use Mintlify docs
  • Vercel — for Next.js / static sites
  • Netlify — for most static docs

Once a preview is deployed, open a new PR and we'll run the eval automatically.


Evaluating agent experience using 2027.dev · View dashboard

@giordano-lucas giordano-lucas changed the title Skip live SDK tests without NOTTE_API_KEY [NOT-491] Skip live SDK tests without NOTTE_API_KEY Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SDK live API tests fail without NOTTE_API_KEY

1 participant