Skip to content

Commit 034a821

Browse files
committed
misc: update README.md
1 parent dd0120f commit 034a821

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,29 @@ https://github.com/python/typed_ast/issues/97). Also with Pipenv you can't
143143
have a second Pipfile. This is why for now we don't have `mypy` listed as a dev package
144144
in the Pipfile.
145145

146+
### Testing
147+
148+
The test suite uses pytest and includes fixtures for testing different cache backends. The `caches` fixture in `tests/conftest.py` is parametrized to test various cache types (e.g., 'simple', 'filesystem', 'redis', 'memcached') and eviction strategies (e.g., 'time-based', 'rest-based', 'rest-and-time-based').
149+
150+
The fixture conditionally depends on server fixtures (e.g., `redis_server`, `memcache_server`) based on the cache type being tested. This ensures that pytest only starts the servers that are actually needed for the test, reducing unnecessary overhead and preventing tests from failing due to missing servers if they don't need them.
151+
152+
For example, if you are testing the 'simple' or 'filesystem' cache types, pytest will not attempt to start Redis or Memcached servers, as they are not required for these cache types.
153+
154+
To run the tests, you can use the following commands:
155+
156+
```
157+
# Run all tests
158+
$ pytest
159+
160+
# Run tests for a specific cache type
161+
$ pytest -k "simple"
162+
163+
# Run tests for a specific eviction strategy
164+
$ pytest -k "time-based"
165+
```
166+
167+
For more information on the test fixtures and how they are used, see the `tests/conftest.py` file.
168+
146169
## Credits
147170

148171
As this is a port of the popular [Flask-Caching](https://github.com/sh4nks/flask-caching) library

0 commit comments

Comments
 (0)