Set up python project:

- I don't use approval testing, as I like to feel closer to the code whilst testing and for tests to be self contained and not rely on external data that has to be kept up to date and bloats the directory structure.
  - I like to use pdm to manage venvs, dependancies and scripts with one modern tool.
  - I bumped the version number for my version.
  - This is an exercise, no reason to have multiple dependency lists.
  - I find pytest and the plugin easier to use and a threshold helpful.  Unittest adds unnecessary boilerplate code.
  - conftest not needed atm
  - Module level comments are helpful.
  - Use linting, type checking and formatting tools - good practice.
  - Update readme given alterations.
  - Update gitignore to new python environment

N.B.  linting errors left until tests in place.
This commit is contained in:
Simon Fothergill committed 2026-09-15 20:51:56 +01:00
1 parent d6407909c7
commit 39ce08d5ea
12 files changed
+1011 -119

No files matched your search

+4 -32
View File
@@ -1,39 +1,11 @@
# Gilded Rose starting position in Python
# Gilded Rose kata attempt, based on the starting position in the original repo.
For exercise instructions see [top level README](../README.md)
Suggestion: create a python virtual environment for this project. See the [documentation](https://docs.python.org/3/library/venv.html)
## Run the unit tests from the Command-Line
# Python environment
```
python -m unittest
```
We use pdm to manange python environment, dependancies and scripts for code checks and testing.
## Run the TextTest fixture from the Command-Line
We check code for types, linting and formatting using standard tools.
For e.g. 10 days:
```
python texttest_fixture.py 10
```
You should make sure the command shown above works when you execute it in a terminal before trying to use TextTest (see below).
## Run the TextTest approval test that comes with this project
There are instructions in the [TextTest Readme](../texttests/README.md) for setting up TextTest. You will need to specify the Python executable and interpreter in [config.gr](../texttests/config.gr). Uncomment these lines:
executable:${TEXTTEST_HOME}/python/texttest_fixture.py
interpreter:python
## Run the ApprovalTests.Python test
This test uses the framework [ApprovalTests.Python](https://github.com/approvals/ApprovalTests.Python). You will need to install Run it like this:
```
python tests/test_gilded_rose_approvals.py
```
You will need to approve the output file which appears under "approved_files" by renaming it from xxx.received.txt to xxx.approved.txt.