Skip to content

Conversation

@nitsanavni
Copy link
Member

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a full Python translation illustrating pytest parametrization and implements a simple Order/Status kata with corresponding tests, plus basic project setup.

  • Introduces extensive test_parametrized_examples.py demonstrating various pytest features.
  • Implements Order and Status classes with state-based tests in test_order_state.py.
  • Provides project config, sample CSV data, readmes, and entry-point setup.

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
python/tests/test_parametrized_examples.py Adds comprehensive pytest parametrization examples
python/tests/test_order_state.py Introduces order state unit tests (duplicated cases)
python/tests/test_data.csv Provides sample CSV data for file-based parametrization
python/tests/README.md Documents parametrization examples and how to run them
python/src/coffeeshop_kata/status.py Defines Status enum for order states
python/src/coffeeshop_kata/order.py Implements Order class with status/change-permission logic
python/pyproject.toml Sets project metadata, Python requirements, and pytest dependency
python/main.py Adds a simple entry-point printing message
python/README.md Describes setup and test commands
python/.python-version Pins Python version
python/.gitignore Adds Python and IDE ignore patterns
Comments suppressed due to low confidence (1)

python/tests/README.md:55

  • [nitpick] The path tests/test_parametrized_examples.py may be confusing if the working directory is python/; consider clarifying the expected CWD or adjusting the path.
uv run pytest tests/test_parametrized_examples.py -v

- Run all tests except expected failing test
- Run expected failing test separately, expecting it to fail
- Matches Java CI pattern but as separate workflow

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@pfichtner
Copy link
Contributor

pfichtner commented Jun 4, 2025

Thank you so much @nitsanavni for the PR. I will review it immediately.


- name: all tests except the expected failing one
working-directory: python
run: uv run pytest -k "not test_order_cannot_be_updated_or_canceled_if_paid" -v
Copy link
Contributor

Choose a reason for hiding this comment

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

The Java workflow calls maven and checks if the test that is expect to fail really did fail.

mvn -B test --fail-at-end || true

Unfortunately, doing this is not really nicely possible from the code (ignoring the mvn failure and grep in the surefire output).
Here in python only the non-failing tests are run, so we don't know if the test that should fail in the build actually failed.
Would it be possible to do this in the python build as well? Would be nice, but is not a must.

Copy link
Contributor

Choose a reason for hiding this comment

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

So that's just a CI-nice-to-have-issue and has nothing to do with the content itself.

Copy link
Member Author

Choose a reason for hiding this comment

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

we do both, next step of the CI checks that the failing test is failing

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I think now I got it: test_order_cannot_be_updated_or_canceled_if_paid is the failing test, right? So you are executing exactly the failing test and the exclamation mark negates the rc of the command so the command is successful if it failed, is that what the line does?

Copy link
Member Author

Choose a reason for hiding this comment

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

exactly 👍

nitsanavni and others added 2 commits June 5, 2025 07:42
- Only trigger on python.yml changes, not all workflows
- Push: main branch only
- PR: targeting main branch only

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@nitsanavni nitsanavni requested a review from pfichtner June 5, 2025 05:49
@nitsanavni
Copy link
Member Author

@pfichtner shall we merge?

@pfichtner
Copy link
Contributor

@pfichtner shall we merge?

Of course! :)
Just wanted to wait til clarification of the negation to avoid an additional PR.

Thanks so much for contributing @nitsanavni!

@pfichtner pfichtner merged commit e799e9b into main Jun 5, 2025
2 checks passed
@pfichtner pfichtner deleted the python-translation branch June 5, 2025 15:26
def load_csv_data() -> list[tuple[str, str, int]]:
"""Load test data from CSV file."""
csv_path = Path(__file__).parent / "test_data.csv"
if not csv_path.exists():
Copy link
Contributor

Choose a reason for hiding this comment

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

@nitsanavni just removed the fallback which is very weird that AI generated such fallback code in a test

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.

3 participants