summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Add use_temp option to SQLite backendJordan Cook2021-04-222-0/+16
| | | | Closes #243
* Combine test_cache.py with BaseCacheTest to run these tests for all backendsJordan Cook2021-04-2210-147/+165
|
* Turn multi-threaded stress tests into test (sub)classesJordan Cook2021-04-228-50/+100
| | | | | | This is mainly to take advantage of fail-fast connection tests; otherwise, these tests may just hang if backend dependenices are installed but backend services are not set up. See issue #221 for details.
* Turn remaining unittest.TestCase classes into pytest-style test classesJordan Cook2021-04-228-144/+82
|
* Reorganize backend integration tests and add some more thorough testsJordan Cook2021-04-227-147/+166
|
* Add a filesystem backendJordan Cook2021-04-213-3/+35
|
* Merge pull request #240 from jsemric/use-thread-local-connections-for-sqliteJordan Cook2021-04-211-0/+15
|\ | | | | Use thread local connections for sqlite
| * add sqlite no-op testsjsemric2021-04-211-0/+15
| |
* | Run multi-threaded tests for all backends, and run with more threads & ↵Jordan Cook2021-04-204-41/+60
| | | | | | | | iterations for merges to master
* | Fix DynamoDbDict.__iter__ to return keys instead of values; update tests to ↵Jordan Cook2021-04-201-21/+21
|/ | | | test for this
* Allow passing any valid backend connection kwargs via BaseCacheJordan Cook2021-04-195-6/+52
| | | | | | | | * Pass `**kwargs` to backend storage classes, split out any that are valid for the backend-specific connection function/class, and pass them to the connection * Add intersphinx links to docs for dependencies * Update and format some more backend class docstrings * Remove 'Unrecognized keyword arguments' warning from `BaseStorage` * Turn `warnings.warn` about using secret keys into a `logging.warning` (due to complaints about too many messages)
* Add option to manually cache response objectsJordan Cook2021-04-191-0/+6
| | | | Updates #98
* Use pytest-order to order tests; remove ipdb recommendationJordan Cook2021-04-192-2/+4
|
* Add some more info about testingJordan Cook2021-04-181-6/+10
|
* Don't show warnings for 'include_get_headers' and 'ignored_parameters' ↵Jordan Cook2021-04-181-5/+5
| | | | | | | kwargs in BaseStorage Also don't name them as private members, since they can safely by changed after initialization (e.g., `session.cache.include_get_headers = True`)
* Read manually instead of using _body, move decode tests to integration testsshiftinv2021-04-182-21/+22
|
* Improve raw response reset, update testsshiftinv2021-04-181-17/+17
|
* Fix handling of decode_content parameter for raw.read(...)shiftinv2021-04-181-5/+8
|
* Add one test case per backend storage classJordan Cook2021-04-126-92/+116
|
* Update all backend-specific integration tests to fail quickly if not set up, ↵Jordan Cook2021-04-126-57/+95
| | | | rarther than silently ignoring or hanging
* Add temporary workaround for /json httpbin endpointJordan Cook2021-04-121-1/+5
|
* Add option to use pytest-httpbin instead of httpbin containerJordan Cook2021-04-121-3/+29
|
* Handle errors due to invalid responses in `BaseCache.urls`Jordan Cook2021-04-101-0/+8
|
* Add remove_old_entries() back to BaseCache as an alias with a DeprecationWarningJordan Cook2021-04-101-1/+7
|
* Improvements to Sphinx documentation:Jordan Cook2021-04-031-7/+7
| | | | | | | | | | | | | | * Use sphinx-apidoc to auto-generate sources for backend modules * Still manually adding other modules for more control over formatting * Add a couple more contributors I missed * Include contributors on readthedocs * Add 'all' Makefile target and clean auto-generated docs * Remove unused build targets in Makefile * Update interpshinx links that have moved * Fix some interpshinx links * Fix some `:ref:` links using auto-generated labels (and some manually added labels where convenient) * Fix some docstring formatting * Fix remaining build warnings
* Split 'core' module into 'session' and 'patcher' modules; keep placeholder ↵Jordan Cook2021-04-023-15/+28
| | | | 'core' module for backwards-compatibility
* Improve backend initialization:Jordan Cook2021-04-023-19/+22
| | | | | | | * Also allow passing a backend class (in addition to backend name and instance) * Detect duplicate params: Backends have different keyword args equivalent to the `cache_name` positional arg, for example `db_name`. If one of these is passed as a keyword arg, it results in a `TypeError` due to duplicate args (See #94). * For backends without dependencies installed, use a placeholder class to delay and re-raise the original `ImportError` * Add type annotations
* Add 'verify' param to cache keyJordan Cook2021-04-011-1/+7
| | | | Closes #209
* Use pytest-xdist to parallelize stress testsJordan Cook2021-04-011-2/+1
|
* Add tests against httpbin container for all supported methods and response ↵Jordan Cook2021-03-312-10/+71
| | | | formats
* Convert test_thread_safety and test_monkey_patch from TestCase classes to ↵Jordan Cook2021-03-314-116/+136
| | | | pytest-style tests
* Split tests into unit and integration tests and run separately in CI; update ↵Jordan Cook2021-03-3114-73/+71
| | | | Contributing Guide with more notes on testing
* Add mocking for requests with redirect historyJordan Cook2021-03-313-47/+51
|
* Fix BaseCache.urls to return only response URLs (no redirect keys)Jordan Cook2021-03-301-3/+2
|
* Move cache key utilities to a separate moduleJordan Cook2021-03-301-5/+26
|
* Add normalization for request jsonJordan Cook2021-03-301-25/+24
|
* Use url-normalize for additional URL normalization for cache keysJordan Cook2021-03-301-0/+5
|
* Also remove invalid responses when running remove_expired_responses()Jordan Cook2021-03-302-0/+14
|
* Add logging to main cache operationsJordan Cook2021-03-301-2/+2
|
* Update get_response + tests to check additional error typesJordan Cook2021-03-291-3/+7
|
* Expose timeout parameter for SQLite backendJordan Cook2021-03-241-0/+8
|
* Pass along optional kwargs to all storage classes, and make default table ↵Jordan Cook2021-03-241-0/+24
| | | | names consistent across backends (`'http_cache'`)
* Enable DynamoDB integration test with GitHub Actions and local ↵Jordan Cook2021-03-242-7/+6
| | | | docker-compose; use in-memory database
* Combine storage classes from backends.storage.* with their respective ↵Jordan Cook2021-03-247-15/+10
| | | | backends in backends.*
* Rename BaseCache.keys_map property and its associated table to 'redirects'Jordan Cook2021-03-241-4/+4
|
* Add a 'urls' property on BaseCache to get all cached URLsJordan Cook2021-03-241-0/+9
| | | | Closes #155
* Add support for setting different expiration times based on URL patternsJordan Cook2021-03-221-0/+58
|
* Add and rewrite unit tests for CachedSession and CachedResponse using ↵Jordan Cook2021-03-226-726/+632
| | | | requests-mock and fixtures
* Add individual expire_after per request. (#177)Sebastian Höffner2021-03-056-24/+271
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add individual expire_after per request. This commit adds a new feature to allow individual expire_after times per request. It involves using a custom CachedSession, PerRequestCachedSession, to be used as the session_factory. * Replace deprecated asserts in unit tests Additionally, some sockets are closed even on test failures. This removes some visual clutter when going through the results. * Update docs and README for per-request caching * Remove per_request and integrate behavior into CachedSession * Make test_return_old_data_on_error more reliable This is achieved by using a fixed date and mocking the backend calls to datetime as well. * Adjust per_request cache to new behavior Also adds HTTPBIN_URL environment variable as in test_cache * Add tests for the function determining the expiration datetime * Adjust backend to store expiration dates This also involves slightly different semantics for deletion, but the behavior stays the same. * Minor: black and isort * Update docs for request Add explanation for expire_after special cases, i.e. 'default' and 'cached' and how precedences are handled * Replace assert statements with methods * Remove invalid snippet from README * Remove invalid sentence from docs. * Make expires_before timezone-aware once And combine the checks for expiration * Simplify complexity by removing 'cached' keyword for expire_after
* Add sanity checks to get_cache, clear, and remove_expired_responses to make ↵Jordan Cook2021-03-042-2/+19
| | | | sure CachedSession is installed