summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* unit test for module list - only the empty use caseroey-vamc19_modulesRoey Prat2020-07-051-0/+5
|
* 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
* version 3.3.8, fix MONITOR output to account for all types of clients3.3.8huangwei-ds52019-08-191-0/+11
| | | | | | | | | | The client section of MONITOR output varies for TCP connections, unix socket connections and commands executed from Lua scripts. Account for each of these cases by including an additional key `client_type` in the MONITOR output. `client_type` will be one of ('tcp', 'unix', 'lua'). `client_address` and `client_port` vary based on the `client_type`. Fixes #1201
* version 3.3.6, fixed a regression in 3.3.5 with pubsub timeouts3.3.6Andy McCurdy2019-08-061-0/+8
| | | | Fixes #1200
* Make pubsub tests more resilient on laggy connectionsAndy McCurdy2019-07-301-12/+40
| | | | | | | | | | Commands sent on pubsub connections (like subscribe, psusbscribe, etc.) do not wait for the server to acknowledge a reply. This can lead to situations where commands are executed out of order. This is more noticeable on laggy connections. This fix ensures that all anticipated messages are read off the pubsub connection before proceeding to the next command
* use a multi-connection client for multiprocess testsAndy McCurdy2019-07-291-0/+12
|
* PING/PONG health checksAndy McCurdy2019-07-282-2/+180
| | | | | | | | | | | | | | | | | | | | | | The `Redis` class and the `ConnectionPool` class now support the "health_check_interval=N" option. By default N=0, which turns off health checks. `N` should be an integer, and when greater than 0, ensures that a health check is performed just before command execution anytime the underlying connection has been idle for more than N seconds. A health check is a full PING/PONG round trip to the Redis server. If a health check encounters a ConnectionError or TimeoutError, the connection is disconnected and reconnected and the health check is retried exactly once. Any error during the retry is raised to the caller. Health check retries are not governed by any other options such as `retry_on_timeout`. In systems where idle times are common, these health checks are the intended way to reconnect to the Redis server without harming any user data. When this option is enabled for PubSub connections, calling `get_message()` or `listen()` will send a health check anytime a message has not been read on the PubSub connection for `health_check_interval` seconds. Users should call `get_message()` or `listen()` at least every `health_check_interval` seconds in order to keep the connection open.
* Ability to create a client that uses a single connectionAndy McCurdy2019-07-233-46/+74
| | | | | | | | | | | | | This has multiple uses: * Single connection clients will not be considered threadsafe. This means certain settings could temporarily be adjusted. For example, a context manager could temporarily modify the encoding behavior for a set of commands. * We can introduce more thorough health checks that only happen when a connection is handed out from the connection pool. * Workloads that issue many commands to Redis should be slightly faster. Prior to this change, the client must retrieve a connection from the pool for each command.
* Handle removed claimed messages without an exceptionThomas Daskalakis2019-07-171-0/+25
| | | | Fixes #1191
* Use nonblocking sockets instead of selectors for healthy connectionsAndy McCurdy2019-07-093-124/+15
| | | | | | | This replaces the work in 3.2.0 to use nonblocking sockets instead of selectors. Selectors proved to be problematic for some environments including eventlet and gevent. Nonblocking sockets should be available in all environments.
* Add READONLY and READWRITE commandsTheo Despoudis2019-07-091-0/+13
|
* Add redis_url cmdline argument for tests (#1170)Grygorii Iermolenko2019-06-061-31/+46
| | | Users can now specify --redis-url when running the test suite to choose a specific server.
* All authentication-related errors now raise AuthenticationErrorAndy McCurdy2019-06-031-0/+14
| | | | | | | AuthenticationError is now a subclass of ConnectionError, which means the connection will be shut down and cleaned up. Fixes #923
* Pass encoding_errors setting to hiredis (>=1.0.0) (#1162)Brian Candler2019-05-291-0/+14
| | | | | Pass encoding_errors setting to hiredis (>=1.0.0). Fixes #1161
* case insensitive response callbacks.Andy McCurdy2019-05-281-0/+3
| | | | | | | this change allows users to call client.execute_command('info') or client.execute_command('INFO') and get the same parsed result. Fixes #1168
* remove Token class in favor of bytestringremove_tokenAndy McCurdy2019-05-281-1/+1
| | | | | | | The Token class was needed when supporting Python 2.6. Now that we've dropped support for 2.6, we don't need it anymore. Fixes #1066
* fix py2 compatmonitorAndy McCurdy2019-05-261-2/+3
|
* add tests for encoding issues and fix bugs foundAndy McCurdy2019-05-261-5/+12
|
* monitor command now has full command text. test suite improvedAndy McCurdy2019-05-261-4/+33
|