mirror of
https://github.com/Kozea/Radicale.git
synced 2025-08-28 19:40:54 +00:00
run rabbitmq tests only if module pika is available
This commit is contained in:
parent
1d747fb407
commit
9d5772901d
1 changed files with 11 additions and 0 deletions
|
@ -21,6 +21,7 @@ Radicale tests related to hook 'rabbitmq'
|
|||
|
||||
import logging
|
||||
import os
|
||||
import pytest
|
||||
|
||||
from radicale.tests import BaseTest
|
||||
from radicale.tests.helpers import get_file_content
|
||||
|
@ -29,6 +30,14 @@ from radicale.tests.helpers import get_file_content
|
|||
class TestHooks(BaseTest):
|
||||
"""Tests with hooks."""
|
||||
|
||||
# test for available pika module
|
||||
try:
|
||||
import pika
|
||||
except ImportError:
|
||||
has_pika = 0
|
||||
else:
|
||||
has_pika = 1
|
||||
|
||||
def setup_method(self) -> None:
|
||||
BaseTest.setup_method(self)
|
||||
rights_file_path = os.path.join(self.colpath, "rights")
|
||||
|
@ -63,6 +72,7 @@ permissions: RrWw""")
|
|||
self.configure({"hook": {"type": "rabbitmq",
|
||||
"dryrun": "True"}})
|
||||
|
||||
@pytest.mark.skipif(has_pika == 0, reason="No pika module installed")
|
||||
def test_add_event(self, caplog) -> None:
|
||||
caplog.set_level(logging.WARNING)
|
||||
"""Add an event."""
|
||||
|
@ -83,6 +93,7 @@ permissions: RrWw""")
|
|||
if (found is False):
|
||||
raise ValueError("Logging misses expected log line")
|
||||
|
||||
@pytest.mark.skipif(has_pika == 0, reason="No pika module installed")
|
||||
def test_delete_event(self, caplog) -> None:
|
||||
caplog.set_level(logging.WARNING)
|
||||
"""Delete an event."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue