Commit Graph

28 Commits

Author SHA1 Message Date
Marcelo Trylesinski 7516daf7a7 Bump pyupgrade version and add __future__.annotations import 2022-04-15 14:16:57 +06:00
Sondre Lillebø Gundersen 87384a91c6 chore: Update `__exit__` signatures
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2022-04-12 20:41:29 +06:00
Michael Manganiello 2f3b153acc
Warn about missing hostname only when default one is available (#1488)
* Warn about missing hostname only when default one is available

The `No hostname was supplied` warning is affecting projects that use
AWS SQS (as detailed in #1357), as a hostname is not required when
setting up the broker URL. Instead, the official documentation [0] specifies
that the valid broker URL formats are:

* `sqs://`
* `sqs://aws_access_key_id:aws_secret_access_key@`

With these formats, the `kombu.utils.url.parse_url` util doesn't return
a hostname, and workers end up triggering the following warning:

> No hostname was supplied. Reverting to default 'None'

As the SQS transport doesn't provide a default value for hostname, this
diff changes the behavior to only warn the user when the hostname hasn't
been supplied but a default one is being set by the default connection
parameters for the defined transport.

Fixes #1357.

[0] https://docs.celeryproject.org/en/stable/getting-started/backends-and-brokers/sqs.html#configuration

* Use caplog default logging level of WARNING
2022-02-02 19:23:14 +06:00
Paul Brown 9c062bdca5
allow getting recoverable_connection_errors without an active transport (#1471)
* allow getting recoverable_connection_errors without an active transport

* move redis transport errors to class

* move consul transport errors to class

* move etcd transport errors to class

* remove redis.Transport._get_errors and references in tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix flake8 errors

* add integration test for redis ConnectionError

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-12-30 12:28:11 +06:00
Mehdi Pourfar a9c4f9837c
respect connection timeout (#1458)
* pass timeout to ensure connection function

* test connection respect its timeout
2021-12-24 15:21:44 +06:00
Thomas Grainger 241b5dcff8
enable pre-commit (#1355)
* enable pre-commit

* use extend-ignore for flake8

* manual flake8 fixes

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update kombu/__init__.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-07-20 19:07:49 +06:00
Matus Valo 1512c5d609 Removed case.skip 2020-08-17 10:16:05 +06:00
Matus Valo 04cf759625 Replace case.skip.todo with pytest 2020-08-17 10:16:05 +06:00
Matus Valo 20e2c45892 Use unittest.mock instead of case 2020-08-16 20:39:26 +06:00
Omer Katz 2c75db39e0 Remove five usage from tests. 2020-07-23 16:33:40 +03:00
Omer Katz 7a6e7cc45b pyupgrade 2020-07-13 16:58:06 +03:00
Matus Valo 75027490c7
Revert incompatible changes in #1193 and additional improvements (#1211)
* Revert incompatible changes introduced in #1193

* Improved integration tests covering connection

* Fix unittests on python2 + flake8 fixes
2020-06-10 15:14:47 +06:00
Matus Valo 16749626a4
default_channel should reconnect automatically (#1209) 2020-06-05 09:20:56 +02:00
Conor Stevenson ff7c1e3041 reuse connection 2020-06-02 14:11:32 +06:00
Conor Stevenson 255b85229b
set _connection in _ensure_connection (#1205)
Co-authored-by: Conor Stevenson <conor@lendingblock.com>
2020-06-01 23:23:05 +02:00
Matus Valo df31de1c6e Fix broken compatibility with Celery 2020-06-01 12:56:32 +06:00
Matus Valo 25a0266651 Ensure connection when connecting to broker 2020-06-01 12:56:32 +06:00
Kevin Fox cbd327dc3b Add support for health_check_interval option in broker_transport_options. (#1145)
* Add support for health_check_interval option in broker_transport_options. #1114

* Added Keivn Fox to authors.

* Do not use default arg for pop() method.

* Add dedicated test case for configurable health_check

* Add test case for when health_check_interval is not supported by connection_class in redis.

* Fix Flake8

* Added more test cases for redis.

* Updated tests.
2020-01-11 11:20:31 +06:00
Mario Rodriguez Molins 81101877a0 Add missing parameter queue_args in kombu.connection.SimpleBuffer (#1128)
* Add missing parameter queue_args in kombu.connection.SimpleBuffer

`queue_args` parameter was introduced in `kombu.simple.SimpleQueue`
class and at the same time in `kombu.connection.SimpleQueue` method.
However, `kombu.connection.SimpleBuffer` was not updated in the
same way.

As `kombu.connection.SimpleBuffer` is using positional arguments to
create a `kombu.simple.SimpleBuffer` object, `exchange_opts` value in
that instance would be None and `queue_args` is going to bet set with
the expected `exchange_opts` value.

* Add tests for SimpleBuffer and SimpleQueue

- Add tests for SimpleBuffer/SimpleQueue methods in kombu.simple module
- Add tests for SimpleQueue and SimpleBuffer tasks in kombu.connection
2019-11-23 00:19:03 +06:00
Shekhar Kamble c6b09a3ab5 fixes #1097 (#1099)
* sanitise url when include_password is false  (fixes #1085)

* fix flake8 error

* fixes #1097

* fix flake8 errors
2019-09-10 22:46:13 +06:00
Shekhar Kamble fcecc30aed sanitise url when include_password is false (fixes #1085) (#1095)
* sanitise url when include_password is false  (fixes #1085)

* fix flake8 error
2019-09-03 14:57:27 +03:00
ngie-eign ec4313b034 Allow users to switch URLs while omitting the resource identifier (#1032)
Prior to this change, one needed to specify a URL using a URI
identifier, e.g., `pyamqp://foo.bar`. This change makes it so calling
`.switch(..)` again results in switching the host, not switching the
resource identifier.

This simplifies setting up connections with just hostnames specifying
the resource identifier once, separately.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
2019-06-24 11:39:18 +06:00
Omer Katz a28e7a27fb Remove unused private method. 2019-01-08 17:25:03 +02:00
Omer Katz 6939d93d7f
Added tests that verify that librabbitmq is selected when available and not selected when it is not available. (#907) 2018-08-16 04:48:33 -05:00
Thomas Achtemichuk 75695205f6 Rename `async` keyword to `asynchronous` (#839)
* Rename `async` keyword to `asynchronous`

* Fixes #742
* Resolves "DeprecationWarning: 'async' and 'await' will become reserved
  keywords in Python 3.7"

* Address PR feedback

* Update appveyor config

* Rename docs and tests
2018-03-19 19:28:43 +02:00
Mads Jensen 65d203c71e Prefer dict literal syntax over dict() (#787)
* Prefer dict literal syntax over dict()

* An overlooked dict-constructor in transport/SQS.py
2017-09-08 07:43:59 +03:00
Anthony Lukach 0f4da8d450 Pass connection options from broker_options to default_channel (#769)
* Pass connection options from broker_options to default_channel (fixes #765)

* Fixup

* Fixup
2017-08-02 12:06:47 +03:00
Ask Solem 6d72e40e5b Rewrite tests to use py.test
NOTE: test_qpid was removed as it's breaking horribly.
It's currently trying to import symbols from kombu.transport.qpid
that don't exist.

assertRaises -> pytest.raises

assertTrue

assertTrue - multiline

assertFalse

assertFalse - multiline

assertIsNone

assertIsNone - multiline

assertEqual

assertEqual - multiline

assertNotEqual

assertNotEqual - multiline

assertGreater - multiline

assertIn

assertIn - multiline

assertNotIn

assertNotIn - multiline

assertIsInstance

assertIsInstance - multiline

assertIsNot

assertIsNot - multiline

assertIsNotNone

assertIs

assertIs - multiline

Manual changes

Now depends on case 1.3.1
2016-08-23 11:38:54 -07:00