feat: add unified unit tests and GitHub Actions CI workflow#697
Conversation
- Create tests/ directory with pytest-based test suite - Add test_polar_transform.py: format_number, Cartesian→Polar math, quadrant detection (25 tests) - Add test_progressions.py: AP/GP/AGP/HP checkers, parse_sequence, format_number (22 tests) - Add test_fibonacci.py: fibonacci() series generation, build_layout() geometry (12 tests) - Add test_morse.py: dictionary completeness, encode/decode, round-trip consistency (18 tests) - Add test_math_quiz.py: is_prime, generate_question, generate_options, get_grade (22 tests) - Add requirements-dev.txt with pytest>=7.0 - Add .github/workflows/tests.yml: CI runs on every PR/push to main across Python 3.10/3.11/3.12 All 119 tests pass locally (python3 -m pytest tests/ -v) Closes #<issue-number>
|
@nishtha-agarwal-211 is attempting to deploy a commit to the Anuj's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a test suite and CI workflow to the repository, covering several existing utility/math/game scripts via dynamic module loading (since the source files run I/O or GUI code at import time).
Changes:
- Adds pytest-based tests for Fibonacci, Math Quiz, Morse, Polar Transform, and AP/GP/AGP/HP Recognizer modules.
- Adds
conftest.pyto extendsys.path, and arequirements-dev.txtpinning pytest. - Adds a GitHub Actions workflow running tests across Python 3.10–3.12.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_progressions.py | Tests for AP/GP/AGP/HP recognizer helpers, loaded dynamically. |
| tests/test_polar_transform.py | Tests using re-implemented helpers mirroring the source. |
| tests/test_morse.py | Tests via re-implemented Morse conversion logic. |
| tests/test_math_quiz.py | Tests for Math Quiz module with tkinter/winsound mocked. |
| tests/test_fibonacci.py | Tests for fibonacci/build_layout with turtle mocked. |
| tests/conftest.py | Adds project root to sys.path. |
| requirements-dev.txt | Adds pytest dev dependency. |
| .github/workflows/tests.yml | New CI workflow running pytest on Py 3.10–3.12. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
🎉 Thank you for your contribution! Your Pull Request has been merged successfully. We appreciate the time and effort you put into improving this project. Contributions like yours help the repository grow and stay useful for everyone. If you'd like to contribute again, please check the open issues and make sure you are assigned before opening another Pull Request. Thanks again for your support! 🙌 |
Summary
Closes #395
This PR addresses the issue requesting an automated testing system. It sets up a unified
pytest-based test suite covering core helper functions across multiple mini-projects, and configures a GitHub Actions workflow to run tests automatically on every Pull Request.Changes Made
🧪 New:
tests/directorytests/conftest.pysys.pathfor clean importstests/test_polar_transform.pyformat_number, Cartesian→Polar conversion, quadrant detectiontests/test_progressions.pyparse_sequence, AP / GP / HP / AGP checkers,format_numbertests/test_fibonacci.pyfibonacci()series generation,build_layout()geometrytests/test_morse.pytests/test_math_quiz.pyis_prime,generate_question,generate_options,get_gradeTotal: 119 tests, all passing ✅
⚙️ New: CI Workflow
.github/workflows/tests.yml— runspytest tests/ -v --tb=shorton every PR and push tomainubuntu-latest📦 New:
requirements-dev.txtpytest>=7.0as a dev dependencyDesign Decisions
importlib.util.spec_from_file_location, which handles hyphenated filenamestkinter,turtle, andwinsoundare mocked withMagicMock; top-levelinput()/ REPL loops are suppressed withunittest.mock.patchTest Run Output
Checklist