Skip to content

Add automated test suite, GitHub Actions CI, and CONTRIBUTING.md#24

Merged
tmaier-kettering merged 2 commits into
mainfrom
copilot/add-automated-testing-strategy
Apr 30, 2026
Merged

Add automated test suite, GitHub Actions CI, and CONTRIBUTING.md#24
tmaier-kettering merged 2 commits into
mainfrom
copilot/add-automated-testing-strategy

Conversation

Copilot AI commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

CodebookAI lacked automated tests, CI, and contributor guidance — making it hard to verify core behavior or accept contributions with confidence.

Tests (133 passing, no live API calls)

File What it covers
test_batch_creation.py forbid_additional_props, single/multi-label and keyword JSONL generation, prompt content, schema structure, empty input, non-ASCII, punctuation, long/short excerpts
test_batch_parsing.py _safe_parse_model_text (valid JSON, fenced, truncated, non-JSON recovery, empty); get_client auth failure; get_batch_results with fully mocked OpenAI client (success, mixed good/bad rows, repair notes, auth error, rate limit, connection error, unexpected schema)
test_data_conversion.py make_str_enum (unicode, Pydantic enforcement), to_long_df (multi-label explode, nested dicts), join_datasets
test_data_import.py Delimiter sniffing, CSV/TSV/Excel reading, non-ASCII, empty files, realistic fixture
test_settings.py User config load/save/roundtrip, get_setting precedence
test_reliability.py Cohen's kappa (known values, perfect agreement, edge cases)

No refactoring of application code was required — all tested logic was already in pure, GUI-free functions.

CI (.github/workflows/tests.yml)

Runs on every push and PR across Python 3.10, 3.11, and 3.12. Installs python3-tk + xvfb-run for headless compatibility. Sets MPLBACKEND=Agg and a null keyring backend to prevent environment-sensitive failures.

Supporting infrastructure

  • requirements-dev.txtpytest, pytest-mock
  • pytest.ini — testpaths, short tracebacks
  • tests/fixtures/sample_labels.csv, sample_quotes.csv, realistic_dataset.csv (financial-domain excerpts including non-ASCII)
  • CONTRIBUTING.md — local setup, running tests, project structure, coding conventions, bug reporting, PR process
  • README.md — new Developer Guide section

Known gaps (still require manual testing)

  • Full GUI workflows (import wizard, settings window, batch-ops panel)
  • Live OpenAI API calls (batch submission, polling, cancellation)
  • Windows Credential Manager / keyring integration

Copilot AI and others added 2 commits April 30, 2026 16:48
- Add tests/ directory with 133 pytest tests covering:
  - batch_creation: JSONL generation, forbid_additional_props, prompt construction
  - batch_parsing: _safe_parse_model_text, get_client, get_batch_results with mocked API
  - data_conversion: make_str_enum, to_long_df, join_datasets
  - data_import: CSV/TSV/Excel reading without GUI
  - settings: user config load/save/precedence
  - reliability: compute_cohens_kappa pure logic
- Add tests/fixtures/ with sample CSV data and a realistic fixture
- Add requirements-dev.txt (pytest, pytest-mock)
- Add pytest.ini configuration
- Add .github/workflows/tests.yml (CI on push + PR, Python 3.10/3.11/3.12)
- Add CONTRIBUTING.md with setup, testing, structure, and contribution guide
- Update README.md with developer/testing section

Agent-Logs-Url: https://github.com/tmaier-kettering/CodebookAI/sessions/e942e5e4-04d0-4469-bc8e-c6be9e3afdaa

Co-authored-by: tmaier-kettering <109093855+tmaier-kettering@users.noreply.github.com>
Agent-Logs-Url: https://github.com/tmaier-kettering/CodebookAI/sessions/e942e5e4-04d0-4469-bc8e-c6be9e3afdaa

Co-authored-by: tmaier-kettering <109093855+tmaier-kettering@users.noreply.github.com>
@tmaier-kettering tmaier-kettering marked this pull request as ready for review April 30, 2026 19:25
@tmaier-kettering tmaier-kettering merged commit ead15aa into main Apr 30, 2026
6 checks passed
@tmaier-kettering tmaier-kettering deleted the copilot/add-automated-testing-strategy branch April 30, 2026 19:25
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