Skip to content

test: add unit tests for setup_logger function - #29

Closed
Dor-bl wants to merge 7 commits into
masterfrom
test-setup-logger-11620468873266907843
Closed

Dor-bl wants to merge 7 commits into
masterfrom
test-setup-logger-11620468873266907843

Conversation

@Dor-bl

@Dor-bl Dor-bl commented Oct 11, 2026

Copy link
Copy Markdown
Owner

🎯 What: Add unit tests for setup_logger in appium/common/logger.py.
📊 Coverage: Tests default setup (logging.NOTSET) and custom logging levels (e.g., logging.DEBUG), checking logger.propagate, level assignment, and stream handler target (sys.stderr).
✨ Result: Achieved 100% test coverage for appium/common/logger.py.


PR created automatically by Jules for task 11620468873266907843 started by @Dor-bl

claude and others added 2 commits September 12, 2026 22:34
The Release workflow triggers on every push to master. On a fork that means
semantic-release rewrites the version in pyproject.toml, commits the change to
the default branch, tags it and then tries to publish the result to PyPI under
the upstream package name.

Gate the job on the repository name so forks keep a clean master.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PjZRpyoEfSCLjTx5ctzQmJ
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@Dor-bl
Dor-bl force-pushed the master branch 2 times, most recently from df25536 to ce054d4 Compare October 26, 2026 18:03
setup_logger adds a stderr handler to the module-level appium logger on
every call, so the tests left extra handlers and a DEBUG level behind for
the rest of the suite. Snapshot and restore the logger in an autouse
fixture, and assert exactly one handler is added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012HCUdSWNJMojXCjBoxhg41
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Chores
    • Release publishing now runs only from the official repository; runs from forks and other repositories skip publishing.
  • Tests
    • Added checks for logger setup, including its output destination, log level, and propagation behavior. Test cleanup also restores shared logger settings after each test.

The release job now runs only in the appium/python-client repository. New unit tests check the default and DEBUG configurations of setup_logger() and restore the shared logger state after each test.

Changes: Release repository guard

Layer / File(s) Summary
Restrict the release job
.github/workflows/publish.yml
The release job checks that github.repository equals appium/python-client before it runs.

Logger setup tests

Layer / File(s) Summary
Test logger setup configuration
test/unit/common/logger_test.py
New tests check propagation, level, handler count, and sys.stderr for default and DEBUG configurations. An autouse fixture restores the shared logger state after each test.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: kazucocoa

Merge Risk: Minimal · up to 8c9f9

The release job is restricted to the upstream repository, and the new logger tests restore shared state between tests. No actionable merge-blocking issue remains after normal checks.

Security architecture risk: Low · up to 8c9f9

The release restriction reduces publishing reachability without expanding permissions or changing application logging. No introduced security concern was identified, but incomplete security coverage and unverified test-execution conditions limit assurance.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed control affects reachability of release operations capable of repository writes and package publishing. With this workflow definition, repositories other than appium/python-client skip those operations; the upstream job retains its existing authority.

Trust Boundaries and Controls

  • observed — The new boundary uses the GitHub repository context at job eligibility, before checkout and credential-consuming commands. It does not introduce a user-supplied release input or interpolate new input into shell commands.
Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title names the main change: adding unit tests for setup_logger. It follows the conventional prefix style and is concise. The changeset adds test/unit/common/logger_test.py with an autouse fixture…
Description check Passed The description states the purpose: unit tests for setup_logger in appium/common/logger.py. It lists the covered cases (default NOTSET level, DEBUG level, propagate, level assignment, and sys.stderr s…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: adding unit tests for setup_logger. It follows the conventional prefix style and is concise. The changeset adds test/unit/common/logger_test.py with an autouse fixture that restores logger state and two tests for setup_logger, which matches the title.

Full details: Description check

Explanation

The description states the purpose: unit tests for setup_logger in appium/common/logger.py. It lists the covered cases (default NOTSET level, DEBUG level, propagate, level assignment, and sys.stderr stream handler), which match the added test file. It is related to the changeset, so the check passes.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files. (1 skipped: 1 unsupported.)

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0e38516d-0e77-4d59-bbb9-e95c7e84ddda
Commits

Reviewing files that changed from the base of the PR and between adb5e64 and 8c9f971.

Files selected for processing: 2

  • .github/workflows/publish.yml
  • test/unit/common/logger_test.py

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

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.

2 participants