Skip to content

Make E2E tests more comprehensive and less flaky - #58

Merged
jovnc merged 5 commits into
git-mastery:mainfrom
jovnc:test/improve-e2e-test
Mar 14, 2026
Merged

Make E2E tests more comprehensive and less flaky#58
jovnc merged 5 commits into
git-mastery:mainfrom
jovnc:test/improve-e2e-test

Conversation

@jovnc

@jovnc jovnc commented Mar 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  1. Refactored conftest.py to make each test's prerequisites explicit and eliminating hidden ordering dependencies

  2. Strengthened assertions in existing tests to validate actual file and state side effects, not just CLI output:

  • test_setup: asserts progress.json starts as [] and .gitmastery.json has correct default flags
  • test_download: asserts .gitmastery-exercise.json contains the correct exercise_name
  • test_verify: asserts a progress entry is written to progress.json with the expected fields
  • test_progress: asserts progress_remote toggles correctly in .gitmastery.json; asserts reset removes the exercise's entry from progress.json

Verification

  1. Build the binary pyinstaller --onefile main.py --name gitmastery
  2. Run python -m pytest tests/e2e/ -v
  3. Confirm all 9 tests pass

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the E2E test suite by making test prerequisites explicit per test (reducing hidden inter-test dependencies) and by asserting real filesystem/config side effects instead of relying only on CLI output.

Changes:

  • Refactored E2E fixtures to use function-scoped setup/download/verify fixtures for clearer, isolated test setup.
  • Strengthened E2E assertions to validate generated config/progress files and their contents.
  • Updated check/setup/download/verify/progress tests to rely on the new fixtures and more specific output/side-effect expectations.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/e2e/conftest.py Replaces the session-scoped exercises fixture with explicit function-scoped setup/download/verify fixtures.
tests/e2e/commands/test_setup.py Adds assertions for default config flags and empty progress.json.
tests/e2e/commands/test_download.py Validates .gitmastery-exercise.json includes the expected exercise_name.
tests/e2e/commands/test_verify.py Verifies verify writes a progress entry with expected fields.
tests/e2e/commands/test_progress.py Asserts progress_remote toggling and that reset removes the exercise entry.
tests/e2e/commands/test_check.py Tightens output assertions to the final “installed and configured” messages.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/e2e/conftest.py Outdated
Comment thread tests/e2e/conftest.py Outdated
Comment thread tests/e2e/conftest.py Outdated

@SAN-MUYUN SAN-MUYUN left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! Just need to take note of the test_progress_reset in terms of how we want to test reset of answer.txt.

Comment thread tests/e2e/commands/test_setup.py Outdated
Comment thread tests/e2e/commands/test_verify.py
Comment thread tests/e2e/commands/test_check.py
Comment thread tests/e2e/commands/test_download.py
Comment thread tests/e2e/commands/test_progress.py
@jovnc
jovnc merged commit 79e88c7 into git-mastery:main Mar 14, 2026
3 checks passed
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.

4 participants