Conversation
Refactor inventory tests: migrate from unit test to `pytest` and update test structure Co-Authored-By: Anthony Em <139152052+AnSiChen@users.noreply.github.com>
Developers on different OSes won’t accidentally introduce line ending changes, keeping the repository history clean.
fix unit test assert
A long error in the terminal when you ran ruff, has now been fixed: `include I` keyword was not found in terminal ruff check --select I --fix .
Davidek523
approved these changes
May 26, 2025
Collaborator
Davidek523
left a comment
There was a problem hiding this comment.
Ran the tests, everything works fine!
Collaborator
Author
|
@Davidek523 If you haven't found any bugs, inconsistency's you can merge it if you want! Note: the all contributor bot doesn't work for some reason, after movement unit tests are done and working, I will create a separate pull request, so we can easily track every change per contributor now and in the future! |
ultimateownsz
added a commit
that referenced
this pull request
May 28, 2025
commit f183c95 Merge: ef6692f 68b393c Author: Davidek523 <davidov520@wp.pl> Date: Wed May 28 11:07:36 2025 +0200 Refactor unittest framework (#118) # Pull Request Template ## Type of Pull Request Only check one box per pull request. - [x] 🛠️ Code - Changes to the codebase. - [ ] 🔄 Revert - Reverts a previously merged commit or PR. - [ ] 📄 Documentation - Updates to documentation files. - [ ] 🎵 Audio - Changes to audio files. - [ ] 🎨 Asset - Updates to design or visual assets. ## Summary <!-- INSTRUCTIONS: - Briefly describe the purpose of this pull request. --> This PR <!-- adds|modifies|updates|fixes|reverts --> ... <!-- Briefly explain what the PR changes. --> refactors the `unit test` framework back to `pytest`, as specified in `requirements_dev.txt`. This change is useful as it simplified the creation of unit tests easier and adds additional support showing errors during testing. The update is also needed, to integrate the [Hypothesis](https://hypothesis.readthedocs.io/en/latest/index.html) library, which employs property based testing. Useful for testing edge cases you haven't thought of. Given the ongoing movement rework, associated with issues #103 & #104 which involved libraries such as NumPy and Pathfinding, it could be very useful. The unit test for the inventory was made by @AnSiChen, I integrated the `get_message` module in the unit test as well, this change could be better in the future if the inventory gets an overhaul, with mock testing for example, or with the use of Hypothesis to handle specific edge cases. ## Related Issues <!-- INSTRUCTIONS: - Mention related issue numbers here. - Example: "Fixes #123, Closes #456." --> This PR <!-- fixes|closes|addresses|reverts --> issue(s) <!-- (e.g., Fixes #123, Closes #456) --> --- ## ✅ Checklist: - [x] Tested the changes locally. - [x] Verified that no breaking changes are introduced. - [ ] Updated documentation (if applicable). ## 🏷️ Labels: `type: ...`, `area: ...`, `game-...`, ... <!-- Fill and expand on this line as needed. See https://github.com/PyCeas/Pyceas/wiki/Guide-to-using-labels for more information. --> commit 68b393c Author: ultimateownsz <saiutechnologies@outlook.com> Date: Mon May 26 00:42:51 2025 +0200 fix ruff import check A long error in the terminal when you ran ruff, has now been fixed: `include I` keyword was not found in terminal ruff check --select I --fix . commit dac598d Author: ultimateownsz <saiutechnologies@outlook.com> Date: Thu May 22 22:41:04 2025 +0200 fix ruff issues fix unit test assert commit c910ef1 Author: ultimateownsz <saiutechnologies@outlook.com> Date: Thu May 22 22:31:10 2025 +0200 Create .gitattributes Developers on different OSes won’t accidentally introduce line ending changes, keeping the repository history clean. commit 2955dc5 Author: ultimateownsz <saiutechnologies@outlook.com> Date: Thu May 22 22:24:45 2025 +0200 Refactor inventory unit tests Refactor inventory tests: migrate from unit test to `pytest` and update test structure Co-Authored-By: Anthony Em <139152052+AnSiChen@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Template
Type of Pull Request
Only check one box per pull request.
Summary
This PR ... refactors the
unit testframework back topytest, as specified inrequirements_dev.txt. This change is useful as it simplified the creation of unit tests easier and adds additional support showing errors during testing.The update is also needed, to integrate the Hypothesis library, which employs property based testing. Useful for testing edge cases you haven't thought of. Given the ongoing movement rework, associated with issues #103 & #104 which involved libraries such as NumPy and Pathfinding, it could be very useful.
The unit test for the inventory was made by @AnSiChen, I integrated the
get_messagemodule in the unit test as well, this change could be better in the future if the inventory gets an overhaul, with mock testing for example, or with the use of Hypothesis to handle specific edge cases.Related Issues
This PR issue(s)
✅ Checklist:
🏷️ Labels:
type: ...,area: ...,game-..., ...