Skip to content

Commit

Permalink
rename listener back again, add filter to pytest.ini
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason R Briggs committed Jan 11, 2020
1 parent 38dfbae commit eb6874b
Show file tree
Hide file tree
Showing 20 changed files with 47 additions and 44 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Version 5.0.2 -

*
*


Version 5.0.1 - Jan 2020
Expand Down
3 changes: 3 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
filterwarnings =
ignore:.*TestListener.*:
2 changes: 1 addition & 1 deletion stomp/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ def on_heartbeat(self):
self.__print('on_heartbeat')


class CombinedListener(StatsListener, WaitingListener, PrintingListener):
class TestListener(StatsListener, WaitingListener, PrintingListener):
"""
Implementation of StatsListener and WaitingListener. Useful for testing.
"""
Expand Down
4 changes: 2 additions & 2 deletions tests/test_activemq.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import pytest

import stomp
from stomp.listener import CombinedListener
from stomp.listener import TestListener
from .testutils import *


@pytest.fixture()
def conn():
conn = stomp.Connection11(get_default_host())
conn.set_listener('testlistener', CombinedListener('123', print_to_log=True))
conn.set_listener('testlistener', TestListener('123', print_to_log=True))
conn.connect(get_default_user(), get_default_password(), wait=True)
yield conn
conn.disconnect(receipt=None)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_artemis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import pytest

import stomp
from stomp.listener import CombinedListener
from stomp.listener import TestListener
from .testutils import *


@pytest.fixture()
def conn():
conn = stomp.Connection11(get_artemis_host())
conn.set_listener('testlistener', CombinedListener('123', print_to_log=True))
conn.set_listener('testlistener', TestListener('123', print_to_log=True))
conn.connect(get_artemis_user(), get_artemis_password(), wait=True)
yield conn
conn.disconnect(receipt=None)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
import pytest

import stomp
from stomp.listener import CombinedListener
from stomp.listener import TestListener
from .testutils import *


@pytest.fixture()
def conn():
conn = stomp.Connection11(get_default_host())
conn.set_listener('testlistener', CombinedListener('123', print_to_log=True))
conn.set_listener('testlistener', TestListener('123', print_to_log=True))
conn.connect(get_default_user(), get_default_password(), wait=True)
yield conn
conn.disconnect(receipt=None)
Expand All @@ -22,7 +22,7 @@ def conn():
@pytest.fixture()
def invalidconn():
conn = stomp.Connection([('192.0.2.0', 60000)], timeout=5, reconnect_attempts_max=1)
conn.set_listener('testlistener', CombinedListener('123', print_to_log=True))
conn.set_listener('testlistener', TestListener('123', print_to_log=True))
yield conn


Expand Down
4 changes: 2 additions & 2 deletions tests/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
import pytest

import stomp
from stomp.listener import CombinedListener
from stomp.listener import TestListener
from .testutils import *


class TestContext(object):
timestamp = time.strftime('%Y%m%d%H%M%S')

def send_test_message(self, conn):
listener = CombinedListener('123', print_to_log=True)
listener = TestListener('123', print_to_log=True)
conn.set_listener('testlistener', listener)
conn.connect(get_default_user(), get_default_password(), wait=True)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest

import stomp
from stomp.listener import CombinedListener
from stomp.listener import TestListener
from stomp import logging
from .testutils import *

Expand All @@ -19,7 +19,7 @@ def is_inside_travis():
@pytest.fixture()
def conn():
conn = stomp.Connection11(get_ipv6_host())
conn.set_listener('testlistener', CombinedListener('123', print_to_log=True))
conn.set_listener('testlistener', TestListener('123', print_to_log=True))
conn.connect('admin', 'password', wait=True)
yield conn
conn.disconnect(receipt=None)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
from .testutils import *


class TransformationListener(CombinedListener):
class TransformationListener(TestListener):
def __init__(self, receipt, print_to_log):
CombinedListener.__init__(self, receipt, print_to_log)
TestListener.__init__(self, receipt, print_to_log)
self.message = None

def on_before_message(self, headers, body):
Expand Down Expand Up @@ -45,7 +45,7 @@ def on_before_message(self, headers, body):
return (headers, body)

def on_message(self, headers, body):
CombinedListener.on_message(self, headers, body)
TestListener.on_message(self, headers, body)
self.message = body

import inspect
Expand Down Expand Up @@ -112,7 +112,7 @@ class TestNoResponseConnectionKill(object):
def test_noresponse(self, server, timeout_thread):
try:
conn = stomp.Connection([('127.0.0.1', 60000)], heartbeats=(1000, 1000))
listener = CombinedListener(print_to_log=True)
listener = TestListener(print_to_log=True)
conn.set_listener('testlistener', listener)
timeout_thread.start()
conn.connect(wait=True)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_multicast.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import pytest

from stomp.adapter.multicast import MulticastConnection
from stomp.listener import CombinedListener
from stomp.listener import TestListener
from stomp.utils import get_uuid
from .testutils import *


@pytest.fixture
def conn():
conn = MulticastConnection()
listener = CombinedListener('123', print_to_log=True)
listener = TestListener('123', print_to_log=True)
conn.set_listener('testlistener', listener)
conn.connect()
yield conn
Expand All @@ -21,7 +21,7 @@ def conn():
@pytest.fixture
def connutf16():
conn = MulticastConnection(encoding='utf-16')
listener = CombinedListener('123', print_to_log=True)
listener = TestListener('123', print_to_log=True)
conn.set_listener('testlistener', listener)
conn.connect()
yield conn
Expand Down
6 changes: 3 additions & 3 deletions tests/test_nonascii.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@pytest.fixture
def conn():
conn = stomp.Connection(get_default_host(), auto_decode=False)
listener = CombinedListener('123', print_to_log=True)
listener = TestListener('123', print_to_log=True)
conn.set_listener('testlistener', listener)
conn.connect(get_default_user(), get_default_password(), wait=True)
yield conn
Expand All @@ -22,7 +22,7 @@ def conn():
@pytest.fixture
def conn_encode():
conn = stomp.Connection(get_default_host(), auto_decode=True)
listener = CombinedListener('123', print_to_log=True)
listener = TestListener('123', print_to_log=True)
conn.set_listener('testlistener', listener)
conn.connect(get_default_user(), get_default_password(), wait=True)
yield conn
Expand All @@ -32,7 +32,7 @@ def conn_encode():
@pytest.fixture
def conn_encode_utf18():
conn = stomp.Connection(get_default_host(), auto_decode=True, encoding='utf-16')
listener = CombinedListener('123', print_to_log=True)
listener = TestListener('123', print_to_log=True)
conn.set_listener('testlistener', listener)
conn.connect(get_default_user(), get_default_password(), wait=True)
yield conn
Expand Down
6 changes: 3 additions & 3 deletions tests/test_override_threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest

import stomp
from stomp.listener import CombinedListener
from stomp.listener import TestListener
from .testutils import *


Expand All @@ -18,9 +18,9 @@ def create_thread(fc):
return f


class ReconnectListener(CombinedListener):
class ReconnectListener(TestListener):
def __init__(self, conn):
CombinedListener.__init__(self, '123', True)
TestListener.__init__(self, '123', True)
self.conn = conn
def on_receiver_loop_ended(self, *args):
if self.conn:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_rabbitmq.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest

import stomp
from stomp.listener import CombinedListener, WaitingListener
from stomp.listener import TestListener, WaitingListener
from .testutils import *


@pytest.fixture()
def conn():
conn = stomp.Connection11(get_rabbitmq_host())
listener = CombinedListener('123', print_to_log=True)
listener = TestListener('123', print_to_log=True)
listener2 = WaitingListener('456')
conn.set_listener('123', listener)
conn.set_listener('456', listener2)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_s10.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@pytest.fixture()
def conn():
conn = stomp.Connection10(get_default_host())
listener = CombinedListener('123', print_to_log=True)
listener = TestListener('123', print_to_log=True)
conn.set_listener('testlistener', listener)
conn.connect(get_default_user(), get_default_password(), wait=True)
yield conn
Expand Down
8 changes: 4 additions & 4 deletions tests/test_s11.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class Test11Send(object):
def test11(self):
conn = stomp.Connection(get_default_host())
tl = CombinedListener('123', print_to_log=True)
tl = TestListener('123', print_to_log=True)
conn.set_listener('', tl)
conn.connect(get_default_user(), get_default_password(), wait=True)
conn.subscribe(destination='/queue/test', ack='auto', id=1)
Expand All @@ -36,7 +36,7 @@ def test11(self):

def testheartbeat(self):
conn = stomp.Connection(get_default_host(), heartbeats=(2000, 3000))
listener = CombinedListener('123', print_to_log=True)
listener = TestListener('123', print_to_log=True)
conn.set_listener('', listener)
conn.connect(get_default_user(), get_default_password(), wait=True)
assert conn.heartbeats[0] > 0
Expand Down Expand Up @@ -65,7 +65,7 @@ def testheartbeat_timeout(self):
\x00''')

conn = stomp.Connection([('127.0.0.1', 60000)], heartbeats=(1000, 1000))
listener = CombinedListener(print_to_log=True)
listener = TestListener(print_to_log=True)
conn.set_listener('', listener)
conn.connect()

Expand Down Expand Up @@ -94,7 +94,7 @@ def testheartbeat_shutdown(self):
\x00''')

conn = stomp.Connection([('127.0.0.1', 60000)], heartbeats=(10000, 10000))
listener = CombinedListener(print_to_log=True)
listener = TestListener(print_to_log=True)
conn.set_listener('', listener)
conn.connect()

Expand Down
6 changes: 3 additions & 3 deletions tests/test_s12.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import stomp
from stomp import exception
from stomp.listener import CombinedListener
from stomp.listener import TestListener
from .testutils import *


@pytest.fixture()
def conn():
conn = stomp.Connection12(get_default_host())
listener = CombinedListener('123', print_to_log=True)
listener = TestListener('123', print_to_log=True)
conn.set_listener('testlistener', listener)
conn.connect(get_default_user(), get_default_password(), wait=True)
yield conn
Expand Down Expand Up @@ -85,7 +85,7 @@ def test_timeout(self):
message: connection failed\x00''')

conn = stomp.Connection12([('127.0.0.1', 60000)])
listener = CombinedListener(print_to_log=True)
listener = TestListener(print_to_log=True)
conn.set_listener('', listener)
try:
conn.connect(wait=True)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_ss.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_disconnect(self, server):
\x00''')

conn = stomp.Connection([('127.0.0.1', 60000)])
listener = CombinedListener(print_to_log=True)
listener = TestListener(print_to_log=True)
conn.set_listener('', listener)
conn.connect()

Expand Down Expand Up @@ -99,7 +99,7 @@ def pump(n):
expected_heartbeat_count = 0

conn = stomp.Connection([('127.0.0.1', 60000)])
listener = CombinedListener(print_to_log=True)
listener = TestListener(print_to_log=True)
conn.set_listener('', listener)
conn.connect()

Expand Down
4 changes: 2 additions & 2 deletions tests/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import stomp
from stomp import transport
from stomp.listener import CombinedListener
from stomp.listener import TestListener
from .testutils import *


Expand All @@ -22,7 +22,7 @@ def stomp_transport():

class TestSSL(object):
def test_ssl_connection(self):
listener = CombinedListener('123', print_to_log=True)
listener = TestListener('123', print_to_log=True)
try:
import ssl
queuename = '/queue/test4-%s' % listener.timestamp
Expand Down
4 changes: 2 additions & 2 deletions tests/test_ssl_sni.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

import stomp
from stomp.listener import CombinedListener
from stomp.listener import TestListener
from .testutils import *


Expand All @@ -25,7 +25,7 @@ def testconnect(self):
receipt_id = str(uuid.uuid4())
conn = stomp.Connection11(get_sni_ssl_host())
conn.set_ssl(get_sni_ssl_host())
listener = CombinedListener(receipt_id, print_to_log=True)
listener = TestListener(receipt_id, print_to_log=True)
conn.set_listener('', listener)
conn.connect(get_default_user(), get_default_password(), wait=True)
conn.subscribe(destination='/queue/test', id=1, ack='auto')
Expand Down
4 changes: 2 additions & 2 deletions tests/test_stompserver.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest

import stomp
from stomp.listener import CombinedListener
from stomp.listener import TestListener
from .testutils import *


@pytest.fixture()
def conn():
conn = stomp.Connection10(get_stompserver_host())
conn.set_listener('testlistener', CombinedListener('123', print_to_log=True))
conn.set_listener('testlistener', TestListener('123', print_to_log=True))
conn.connect(wait=True)
yield conn
conn.disconnect(receipt=None)
Expand Down

0 comments on commit eb6874b

Please sign in to comment.