summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* daemonize the thread to see if the tests will continueAndy McCurdy2021-06-301-4/+3
|
* Add support for the ABSTTL option of the RESTORE command. (#1423)Simon Charette2020-11-221-0/+13
| | | Add support for the ABSTTL option of the RESTORE command.
* Add optional exception handler to PubSubWorkerThread (#1395)Abhimanyu Deora2020-10-261-0/+24
| | | | | Add optional exception handler to PubSubWorkerThread Co-authored-by: Abhimanyu Deora <adeora@drwholdings.com>
* 🕰️ Use monotonic clock in Lock (and tests)Jack Edge2020-10-121-4/+4
| | | | | | | | | | | | | | | | | During a call to `acquire()`, if the call is `blocking` and has a `blocking_timeout` set, it uses `time.time()` calls to determine when to give up attempting to acquire the lock. However, since `time.time()` is marked as "adjustable", it is possible for it to go backwards or forwards at a rate other than 1 second per second, meaning the spinloop may exit earlier or later than expected. By changing the implementation to use `time.monotonic()`, which is guaranteed to never go backwards, and not be affected by system clock updates, this potential problem is fixed. For the same reason, some time dependent lock tests have also been changed to use `time.monotonic()`.
* Added the ACL LOG command available in Redis 6Andy McCurdy2020-08-192-10/+63
| | | | | | | | | `acl_log()` returns a list of dictionaries, each describing a log entry. `acl_log_reset()` instructs the server to truncate the log. Thanks @2014BDuck Fixes #1307
* All values within Redis URLs are url-unquoted via default.Andy McCurdy2020-08-151-114/+16
| | | | | | | | Prior versions of redis-py supported this by specifying the ``decode_components`` flag to the ``from_url`` functions. This is now done by default and cannot be disabled. Fixes #589
* Remove support for end-of-life Python 2.7 (#1318)Jon Dufresne2020-08-0612-102/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove support for end-of-life Python 2.7 Python 2.7 is end of life. It is no longer receiving bug fixes, including for security issues. Python 2.7 went EOL on 2020-01-01. For additional details on support Python versions, see: Supported: https://devguide.python.org/#status-of-python-branches EOL: https://devguide.python.org/devcycle/#end-of-life-branches Removing support for EOL Pythons will reduce testing and maintenance resources while allowing the library to move towards a modern Python 3 style. Python 2.7 users can continue to use the previous version of redis-py. Was able to simplify the code: - Removed redis._compat module - Removed __future__ imports - Removed object from class definition (all classes are new style) - Removed long (Python 3 unified numeric types) - Removed deprecated __nonzero__ method - Use simpler Python 3 super() syntax - Use unified OSError exception - Use yield from syntax Co-authored-by: Andy McCurdy <andy@andymccurdy.com>
* LPOS: add new command (#1354)Paul Spooren2020-07-221-0/+32
| | | | | Added the LPOS command from Redis 6.0.6 Fixes #1353
* Dockerize (#1365)Andy McCurdy2020-07-206-48/+68
|\ | | | | | | | | | | | | | | | | Provide a docker development and testing environment * CI (Travis) now runs tests via the same docker environment that is available to developers. * A simple Makefile has been added to make getting started easier. * `make dev` will standup the development environment. * `make test` will standup the development environment and also run the test suite. * `make clean` will remove the development environment.
| * make the slowlog_get test more resilient to multiple clients being connectedAndy McCurdy2020-07-201-4/+2
| |
| * rename absurdly long test nameAndy McCurdy2020-07-151-1/+1
| |
| * Check that we're subscribed to the right channelsAndrew Brookins2020-07-151-5/+2
| |
| * Attempt to fix a timing bugAndrew Brookins2020-07-141-1/+1
| |
| * Use the existing --redis-url param to get master hostAndrew Brookins2020-07-101-9/+7
| |
| * Fix flake8 errorsAndrew Brookins2020-07-092-3/+1
| |
| * Pass the master hostname to testsAndrew Brookins2020-07-094-39/+61
| |
| * WIP on base imageAndrew Brookins2020-07-091-2/+9
| |
* | Support for loading, unloading and listing Redis Modules (#1360)Roey Prat2020-07-131-0/+5
|/ | | | | | | | | | | * Support for loading, unloading and listing Redis Modules * minor fixes for flake * unit test for module list - only the empty use case * ModuleError should inherit from ResponseError rather than RedisError Co-authored-by: Vamsi Atluri <vamc19@gmail.com>
* Do not un-escape \ characters when parsing MONITOR outputAndy McCurdy2020-06-081-0/+7
| | | | | | | Prior to this, escaped slashes ("\\") were un-escaped. This caused the strings "foo\x92" and "foo\\x92" to be represented the same way in the output. Fixes #1349
* Fix for HSET argument validation to allow any non-None keyAleksMat2020-05-091-0/+4
| | | | | Fixes #1337 Fixes #1341
* Fix typo (missing space) in exception message (#1334)Jon Dufresne2020-04-281-1/+5
|
* Remove unnecessary coerce to list (#1321)Jon Dufresne2020-04-131-1/+1
| | | | sorted() takes any iterable and always returns a new list. No need to eagerly coerce to a list.
* Fix str/bytes mixup in PythonParser.read_response() (#1324)Jon Dufresne2020-04-131-0/+15
| | | | | | | | | | | | Calling str() on a bytes object can result in a BytesWarning being emitted and usually indicates a mixup between byte and string handling. Now, in the event of an invalid RESP response, use the repr value of the raw response in the exception message. Can further simplify the bytes/str handling by comparing the first byte as a bytes object instead of converting it to str. The bytes literal is available on all supported Pythons. This removes the need for the compatibility function, byte_to_chr().
* Add test for Lock(..., thread_local=False) (#1326)Jon Dufresne2020-04-111-0/+7
| | | Covers the class redis.utils.dummy.
* Lock.extend() can now replace the lock's existing TTL with a new valuelaixintao2020-03-241-0/+8
| | | | | | | Lock.extend() now has a new option, `replace_ttl`. When False (the default), Lock.extend() adds the `additional_time` to the lock's existing TTL. When replace_ttl=True, the lock's existing TTL is replaced with the value of `additional_time`.
* constant for redis 6 RC candidates in tests.Andy McCurdy2020-03-123-20/+26
| | | | replace with a '6.0.0' literal when Redis 6 is GA
* add keepttl option to set command.laixintao2020-03-121-0/+9
| | | | | fixes #1304 fixes #1280
* Clear pipeline watch state after execNick Gaya2020-03-103-21/+58
|
* Don't send DISCARD after ExecAbortError in pipelineNick Gaya2020-03-101-0/+15
| | | | | | | The `EXECABORT` error type was added in Redis 2.6.5 and is returned from an `EXEC` command to indicate that the transaction was aborted due to an invalid command. It is not necessary to call `DISCARD` after this error, and doing so causes a "DISCARD without MULTI" error.
* mark test_spop_multi_value as needing server 3.2.0 or greaterAndy McCurdy2020-03-031-0/+1
| | | | fixes #1298
* add support for the MEMORY STATS commandAndy McCurdy2020-02-251-0/+11
| | | | Fixes #1268
* Support memoryview encoding/decoding as a no-opCody-G2020-02-242-1/+56
| | | | | | | | | | This allows memoryview instances to be passed to Redis command args that expect strings or bytes. The memoryview instance is sent directly to the socket such that there are zero copies made of the underlying data during command packing. Fixes #1265 Fixes #1285
* Optimize sleeping while blocking for a lockColas Le Guernic2020-02-241-6/+17
| | | | | | | | | When waiting to acquire a lock, the Lock object will sleep until the lock is acquired or until blocking_timeout has elapsed. This optimization calculates whether the next iteration will occur after blocking_timeout has elapsed and short circuits it immediately. Fixes #1263
* Drop unused variables and imports (#1284)Jon Dufresne2020-02-121-2/+1
|
* Enable warnings during tests and fix discovered cases (#1283)Jon Dufresne2020-02-121-2/+4
| | | | | | Helps identify problematic or buggy code. When a warning is displayed, it should be analyzed and fixed. The r and r2 fixture now close the client after the test is complete.
* Improve Redis.hmset() warning messageJon Dufresne2020-02-121-13/+15
| | | | | | | | | It now describe what is deprecated and displays for the callers line by using stacklevel=2. The warning is now tested and not emitted during normal test runs. Fixes #1282
* Make hset support multiple field/value pairs. (#1271)赖信涛2020-02-071-1/+16
| | | | | | | | | | | | * make `hset` command support multi field/value pairs. see: https://redis.io/commands/hset close https://github.com/andymccurdy/redis-py/issues/1269 deprecated: hmset Co-authored-by: Alan Mai <0110amai@gmail.com>
* remove Redis and ConnectionPool __eq__ comparisonAndy McCurdy2020-02-012-68/+0
| | | | | | | | | | | | | After further thought this was a bad idea. Just because two connection pools share the same connection arguments does not make them equal. It would seem quite odd if pool_a == pool_b yet pool_a.disconnect() doesn't close all of pool_b's connections. Ref #1240 Fixes #1277 Fixes #1275 Fixes #1267 Fixes #1273
* better thread-safety for ConnectionPool (#1270)Andy McCurdy2020-01-301-1/+1
| | | Better thread and fork safety for ConnectionPool and BlockingConnectionPool
* add type filter to scan functionnetocp2020-01-301-0/+8
| | | | Fixed #1220
* Add test for pipeline.transaction(value_from_callable=True)Andy McCurdy2019-12-291-0/+8
|
* Added the 'ssl_check_hostname' option.Andy McCurdy2019-12-291-0/+8
| | | | | | | | 'ssl_check_hostname' tells SSL Connections to whether to require the TCP hostname to match the hostname specified in the SSL Cert. By default 'ssl_check_hostname' is False to maintain backwards compatibility. Fixed #1196
* Allow setting client_name during connection construction.Peter van Dijk2019-12-291-7/+38
| | | | | | Client instances and Connection pools now accept "client_name" as an optional argument. If supplied, all connections created will be named via CLIENT SETNAME once the connection to the server is established.
* 'with' statement for PubSub (#765)Dmitry Kuragin2019-12-291-0/+9
| | | PubSub objects are now context managers.
* Testing the boolean nature of Pipeline instance should always return True.Andy McCurdy2019-12-291-3/+5
| | | | | | | | Prior to this, pipeline instances used __len__() which returns the number of queued commands on the pipeline. When there were no queued commands, the pipeline instance would evaluate to 0 or False. Fixes #994
* Added support for ACL commandsAndy McCurdy2019-12-282-1/+257
|
* Compare numbers using '==' instead of 'is' (#1245)Jon Dufresne2019-11-121-5/+5
| | | | | | While numbers are frequently singletons as an optimization, it is not guaranteed by the language specification. Fixes flake8 error: F632 use ==/!= to compare str, bytes, and int literals
* Add equality test on Redis client and conn pool (#1240)Rajiv Bakulesh Shah2019-11-112-0/+68
| | | Add equality test on Redis client and connection pool
* Allow Pipeline.execute() to execute on empty command stack if it is watching ↵Brian Maissy2019-10-241-0/+13
| | | | keys
* Support old EPEL-7 Redis. (#1227)tuxmaster50002019-10-181-0/+7
| | | Fix test suite with Redis versions pre-5.0.0