diff options
author | Felix Yan <felixonmars@archlinux.org> | 2021-06-11 15:21:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-11 09:21:09 +0200 |
commit | e5dbfed8ae9fb5e7d2d76be682517a9779137c77 (patch) | |
tree | e4754c1e5b35a8388eaca33d39e14557b2d3d0a5 /t | |
parent | 89b92f7f2c1a6ac962b12dd8fc8c8c44587e50a9 (diff) | |
download | kombu-e5dbfed8ae9fb5e7d2d76be682517a9779137c77.tar.gz |
Move pytest.importorskip to run earlier (#1346)
* Move pytest.importorskip to run earlier
Currently pytest fails to collect tests when `azure` is not present. Moving the pytest.importorskip clause before `from kombu.transport import azureservicebus` fixes it.
```
==================================== ERRORS ====================================
__________ ERROR collecting t/unit/transport/test_azureservicebus.py ___________
ImportError while importing test module '/build/python-kombu/src/kombu-5.1.0/t/unit/transport/test_azureservicebus.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.9/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
t/unit/transport/test_azureservicebus.py:12: in <module>
from kombu.transport import azureservicebus
kombu/transport/azureservicebus.py:66: in <module>
import azure.core.exceptions
E ModuleNotFoundError: No module named 'azure'
```
* Add # noqa to make linter happy
Diffstat (limited to 't')
-rw-r--r-- | t/unit/transport/test_azureservicebus.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/t/unit/transport/test_azureservicebus.py b/t/unit/transport/test_azureservicebus.py index bc96bbff..47cc9fd5 100644 --- a/t/unit/transport/test_azureservicebus.py +++ b/t/unit/transport/test_azureservicebus.py @@ -9,11 +9,10 @@ from collections import namedtuple from kombu import messaging from kombu import Connection, Exchange, Queue -from kombu.transport import azureservicebus -import azure.servicebus.exceptions -import azure.core.exceptions pytest.importorskip('azure.servicebus') - +from kombu.transport import azureservicebus # noqa +import azure.servicebus.exceptions # noqa +import azure.core.exceptions # noqa from azure.servicebus import ServiceBusMessage, ServiceBusReceiveMode # noqa |