Skip to content

Commit 9567362

Browse files
committed
Replace py.test imports with pytest
1 parent e4074c1 commit 9567362

5 files changed

Lines changed: 25 additions & 25 deletions

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import sys
44

5-
import py.test
5+
import pytest
66

77
import riemann_client.transport
88

@@ -25,6 +25,6 @@ def disconnect(self):
2525
self.string.close()
2626

2727

28-
@py.test.fixture
28+
@pytest.fixture
2929
def string_transport():
3030
return StringTransport()

tests/test_riemann_auto_flushing_queued_client.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import absolute_import
22

3-
import py.test
3+
import pytest
44
import socket
55
import time
66

@@ -9,7 +9,7 @@
99
import riemann_client.transport
1010

1111

12-
@py.test.fixture
12+
@pytest.fixture
1313
def blank_transport():
1414
return riemann_client.transport.BlankTransport()
1515

@@ -25,12 +25,12 @@ def send(self, *args, **kwargs):
2525
raise socket.error(32, '[Errno 32] Broken pipe')
2626

2727

28-
@py.test.fixture
28+
@pytest.fixture
2929
def broken_transport():
3030
return BrokenTransport()
3131

3232

33-
@py.test.fixture
33+
@pytest.fixture
3434
def auto_flushing_queued_client(request, blank_transport):
3535
"""A Riemann client using the StringIO transport and
3636
AutoFlushingQueuedClient with max_delay=300 and
@@ -49,7 +49,7 @@ def disconnect():
4949
return client
5050

5151

52-
@py.test.fixture
52+
@pytest.fixture
5353
def auto_flushing_queued_client_delay(request, blank_transport):
5454
"""A Riemann client using the StringIO transport and
5555
AutoFlushingQueuedClient with max_delay=1 and
@@ -68,7 +68,7 @@ def disconnect():
6868
return client
6969

7070

71-
@py.test.fixture
71+
@pytest.fixture
7272
def auto_flushing_queued_client_batch5(request, blank_transport):
7373
"""A Riemann client using the StringIO transport and
7474
AutoFlushingQueuedClient with max_delay=300 and
@@ -87,7 +87,7 @@ def disconnect():
8787
return client
8888

8989

90-
@py.test.fixture
90+
@pytest.fixture
9191
def auto_flushing_queued_client_batch5_broken_f(request, broken_transport):
9292
"""A Riemann client using the StringIO transport and
9393
AutoFlushingQueuedClient with max_delay=300 and
@@ -107,7 +107,7 @@ def disconnect():
107107
return client
108108

109109

110-
@py.test.fixture
110+
@pytest.fixture
111111
def auto_flushing_queued_client_batch5_broken_t(request, broken_transport):
112112
"""A Riemann client using the StringIO transport and
113113
AutoFlushingQueuedClient with max_delay=300 and
@@ -127,13 +127,13 @@ def disconnect():
127127
return client
128128

129129

130-
@py.test.fixture
130+
@pytest.fixture
131131
def using_simple_queue(auto_flushing_queued_client):
132132
"""An event queue with a single event"""
133133
auto_flushing_queued_client.event(service='test')
134134

135135

136-
@py.test.fixture
136+
@pytest.fixture
137137
def large_queue(auto_flushing_queued_client):
138138
"""An event queue with 100 events"""
139139
items = ['-->{0}<--'.format(i) for i in range(0, 1000)]

tests/test_riemann_client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import sys
55
import uuid
66

7-
import py.test
7+
import pytest
88

99
import riemann_client.client
1010
import riemann_client.riemann_pb2
@@ -14,7 +14,7 @@
1414
basestring = str
1515

1616

17-
@py.test.fixture
17+
@pytest.fixture
1818
def client(request, string_transport):
1919
client = riemann_client.client.Client(transport=string_transport)
2020
client.transport.connect()
@@ -26,7 +26,7 @@ def disconnect():
2626
return client
2727

2828

29-
@py.test.fixture
29+
@pytest.fixture
3030
def unique():
3131
return str(uuid.uuid4())
3232

@@ -68,7 +68,7 @@ def test_udp_query(self):
6868
transport = riemann_client.transport.UDPTransport()
6969
client = riemann_client.client.Client(transport)
7070

71-
with py.test.raises(Exception):
71+
with pytest.raises(Exception):
7272
client.query('true')
7373

7474
def test_events(self, client):
@@ -81,7 +81,7 @@ def test_events_len(self, client):
8181
assert len(message.events) == 2
8282

8383

84-
@py.test.fixture
84+
@pytest.fixture
8585
def event(unique):
8686
return riemann_client.client.Client.create_event({
8787
'host': 'test.example.com',
@@ -104,7 +104,7 @@ def test_attributes(self, event, unique):
104104
assert event.attributes[0].value == unique
105105

106106

107-
@py.test.fixture
107+
@pytest.fixture
108108
def event_as_dict(event):
109109
return riemann_client.client.Client.create_dict(event)
110110

tests/test_riemann_queued_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from __future__ import absolute_import
22

3-
import py.test
3+
import pytest
44

55
import riemann_client.client
66
import riemann_client.riemann_pb2
77
import riemann_client.transport
88

99

10-
@py.test.fixture
10+
@pytest.fixture
1111
def queued_client(request, string_transport):
1212
"""A Riemann client using the StringIO transport and QueuedClient"""
1313
client = riemann_client.client.QueuedClient(transport=string_transport)
@@ -20,13 +20,13 @@ def disconnect():
2020
return client
2121

2222

23-
@py.test.fixture
23+
@pytest.fixture
2424
def using_simple_queue(queued_client):
2525
"""An event queue with a single event"""
2626
queued_client.event(service='test')
2727

2828

29-
@py.test.fixture
29+
@pytest.fixture
3030
def large_queue(queued_client):
3131
"""An event queue with 100 events"""
3232
items = ['-->{0}<--'.format(i) for i in range(0, 1000)]

tests/test_riemann_transport.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import absolute_import
22

3-
import py.test
3+
import pytest
44

55
import riemann_client.riemann_pb2
66
import riemann_client.transport
@@ -24,13 +24,13 @@ def test_socket_recvall_short():
2424
assert socket_recvall(FakeSocket(), 5) == b'hello'
2525

2626

27-
@py.test.fixture
27+
@pytest.fixture
2828
def tcp_transport():
2929
return riemann_client.transport.TCPTransport()
3030

3131

3232
def test_not_yet_connected(tcp_transport):
33-
with py.test.raises(RuntimeError):
33+
with pytest.raises(RuntimeError):
3434
tcp_transport.send(riemann_client.riemann_pb2.Msg())
3535

3636

0 commit comments

Comments
 (0)