Skip to content

Test miner color log helpers#5219

Merged
Scottcjn merged 1 commit into
Scottcjn:mainfrom
iamdinhthuan:test-miner-color-logs
May 14, 2026
Merged

Test miner color log helpers#5219
Scottcjn merged 1 commit into
Scottcjn:mainfrom
iamdinhthuan:test-miner-color-logs

Conversation

@iamdinhthuan
Copy link
Copy Markdown

Summary

  • add unit coverage for duplicated miner color_logs.py helper modules
  • cover NO_COLOR, known and unknown color handling, level mapping, convenience helpers, and print_colored output
  • parameterize the same assertions across root, Linux, macOS, and Windows miner helper files

Bounty path: rustchain-bounties#1589
Wallet/miner ID: iamdinhthuan

Verification

  • PYTHONDONTWRITEBYTECODE=1 python -m pytest tests/test_miner_color_logs.py -q -> 64 passed
  • python -m py_compile tests/test_miner_color_logs.py miners/color_logs.py miners/linux/color_logs.py miners/macos/color_logs.py miners/windows/color_logs.py -> passed
  • git diff --check -- tests/test_miner_color_logs.py -> passed

Duplicate check

  • Existing local Auto Batch - V2 Features (700 RTC) #1589 claims cover other test files only.
  • Open RustChain PR scan for color_logs, color log, NO_COLOR, and miner color returned no matches before publishing this PR.

@github-actions
Copy link
Copy Markdown
Contributor

Welcome to RustChain! Thanks for your first pull request.

Before we review, please make sure:

  • Your PR has a BCOS-L1 or BCOS-L2 label
  • New code files include an SPDX license header
  • You've tested your changes against the live node

Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150)

A maintainer will review your PR soon. Thanks for contributing!

@github-actions github-actions Bot added BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) tests Test suite changes labels May 14, 2026
Copy link
Copy Markdown
Contributor

@qiuluoli qiuluoli left a comment

Choose a reason for hiding this comment

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

Code Review: Test Coverage for Miner Color Log Helpers

I reviewed the test file tests/test_miner_color_logs.py and this is a well-structured test suite.

What I reviewed:

  • File: tests/test_miner_color_logs.py (95 lines)
  • Tests for color logging functionality across different platforms

Technical observations:

  1. Good test structure: Uses pytest fixtures with parametrization to test all color_logs.py variants (base, linux, macos, windows)
  2. Comprehensive coverage: Tests cover all major color codes (RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET)
  3. Dynamic module loading: Uses importlib.util to load modules dynamically - good for testing platform-specific variants

Suggestions:

  1. Line 21: The module name construction is complex - consider a helper function for readability
  2. Edge cases: Could add tests for:
    • Empty string input to color functions
    • Nested color codes
    • ANSI escape sequence validation
  3. Platform detection: Consider testing that the correct module is used based on platform.system()

Minor issues:

  • The test file imports modules dynamically which is fine, but consider adding a comment explaining why (platform-specific implementations)

I received RTC compensation for this review.

Wallet: RTCe92afbf2156da6009fbabcace9ed46f5ddaaa0f2

@Scottcjn Scottcjn merged commit bb5d93c into Scottcjn:main May 14, 2026
11 of 12 checks passed
Copy link
Copy Markdown

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) size/M PR: 51-200 lines tests Test suite changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants