Gramex 1.91 adds multiple rate limits and Pytest based testing.
Rate limit now supports multiple configuration values.
ratelimit
can be an array of rate limit configurations. For example, to set 2 limit:
ratelimit:
- pool: daily-user-pool
keys: [daily, user]
limit: 30
- pool: daily-pool
keys: [daily]
limit: 100
You can now use handler.get_ratelimit()
to access the rate limit for the current request.
More details about ratelimit
can be found here
As we migrate from the unmaintained nosetests to pytest,
we were running only pure Python tests with pytest
.
Now, we run Gramex tests with pytest
too. We first run gramex
to start the server, then run pytest
, then shut down the server.
Advantage: clean shutdown of the tests. (nosetests sometimes doesn’t cleanly shutdown)
================ test session starts ======================
platform win32 -- Python 3.9.13, pytest-7.2.0, pluggy-1.0.0
rootdir: C:\site\gramener.com\viz\async-gramex, configfile: pyproject.toml, testpaths: pytest
plugins: anyio-3.6.2, typeguard-4.0.0, yamlns-0.11.0
collected 53 items
pytest\test_chatgpthandler.py .......... [ 18%]
pytest\test_cli.py ..... [ 28%]
pytest\test_data.py ..................... [ 67%]
Gramex 1.91 is backward compatible with previous releases unless the release notes say otherwise. We ensure this with automated tests.
Every Gramex release is tested for security vulnerabilities using the following tools.
The Gramex code base has: