Skip to content

refactor: test organization and CI improvements#6

Merged
nycomp merged 15 commits into
mainfrom
refactor/test-organization
May 21, 2026
Merged

refactor: test organization and CI improvements#6
nycomp merged 15 commits into
mainfrom
refactor/test-organization

Conversation

@nycomp
Copy link
Copy Markdown
Contributor

@nycomp nycomp commented May 21, 2026

Summary

  • Reorganized tests into smoke/unit/integration directories for better categorization
  • Added GitHub Actions workflow to run tests automatically on push/PR
  • Added pre-commit git hooks for formatting (ruff) and testing
  • Standardized line endings to LF via .gitattributes
  • Fixed 73 ruff linting issues across the codebase

Test organization

  • Smoke tests: Basic import and functionality checks
  • Unit tests: Isolated tests for individual modules
  • Integration tests: Tests that verify integration between components

CI/CD improvements

  • GitHub Actions workflow runs smoke and unit tests on every push and PR
  • Pre-commit hooks ensure code quality before commits
  • Added PowerShell and Bash scripts for hook installation

Code quality

  • Applied ruff auto-fixes across the codebase
  • Manually fixed remaining ruff issues in increasing order of difficulty
  • Added comprehensive .gitignore and .gitattributes configuration

🤖 Generated with Claude Code

ngjunsiang and others added 15 commits May 14, 2026 16:04
- Add default excludes to pyproject.toml:
  - **/.*
  - **/__pycache__
  - **/node_modules
  - **/.venv, **/venv

- Exclude unnecessary files from Pylance analysis
- Organize tests into subdirectories by type:
  - tests/smoke/ - Basic sanity checks (imports, instantiation)
  - tests/unit/ - Individual method tests in isolation
  - tests/integration/ - Full lifecycle and interaction tests

- Delete old test files from tests/ root
- Add __init__.py files to each test subdirectory
- Run tests on push to main branch
- Run tests on pull requests to main
- Uses Poetry for dependency management
- Runs smoke tests and unit tests separately
- post-edit: Run ruff format on edited Python files
- pre-commit: Run smoke tests before committing
- pre-push: Run ruff check before pushing

- Add scripts/install-hooks.sh to install these hooks for other developers
- Fix smoke tests to match existing module structure
- Update ruff configuration to use new lint.* format
- Remove unused imports (CredentialError, CredentialStorage)
- Fix f-strings without placeholders
- Sort imports
- Fix callable check (use callable() instead of hasattr(x, '__call__'))
- Remove trailing whitespace

This fixes 9 auto-fixable ruff issues. 61 issues remain (mostly E501 line length).
- Set all text files to use LF line endings
- Explicitly declare Python, YAML, TOML, JSON, Markdown, shell scripts as LF
- Keep Windows batch files as CRLF
This commit addresses all ruff linting issues, organized by fix difficulty:

Easy fixes (16 issues):
- F401 (5): Remove unused imports in smoke tests
- E402 (1): Add noqa comment for intentional late import
- ARG001 (3): Prefix unused fixture parameters with _
- SIM105 (6): Use contextlib.suppress() instead of try/except/pass

Medium fixes (3 issues):
- B011 (1): Replace assert False with raise AssertionError()
- B904 (2): Add 'from' clause to raise statements in except blocks

Hard fixes (54 issues):
- E501 (39): Fix line length issues (>88 chars)
  - Break long typer.Option help text across multiple lines
  - Break long string literals in console.print() calls
  - Break long API calls across multiple lines
  - Break long function parameters across multiple lines
  - Reformat long docstring lines
  - Fix os.open() calls with long flags

Additional improvements:
- Add .gitattributes to standardize line endings to LF
- Add contextlib imports where needed for contextlib.suppress()

All smoke and unit tests still pass after these changes.
- Add comprehensive development guide covering testing, hooks, and workflow
- Document Claude Code hooks (post-edit, pre-commit, pre-push)
- Document test structure (smoke, integration, unit)
- Update README with link to development guide
- Refactor unit tests for Config class

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Fixes test failures caused by Parameter.make_metavar() signature change
in Click 8.3.x. Typer 0.25.1+ supports the new Click API.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Remove unused pathlib.Path import
- Remove unused ConfigError import

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Patch campus_cli.auth.common.credentials instead of the non-existent
campus_cli.auth.status.credentials. The status command is in login.py
and imports credentials via common.get_token_status().

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Update install-hooks scripts to use .\.venv\Scripts\poetry.exe instead of
relying on PATH. This fixes "poetry: command not found" errors when git
runs hooks in a different environment.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@nycomp nycomp merged commit 043ca4d into main May 21, 2026
1 check passed
@nycomp nycomp deleted the refactor/test-organization branch May 21, 2026 03:31
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