Skip to content

Commit db07022

Browse files
authored
Merge pull request #493 from nats-io/ci-updates
CI updates
2 parents ec5da08 + 8699e07 commit db07022

File tree

5 files changed

+32
-11
lines changed

5 files changed

+32
-11
lines changed

.travis.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ cache:
55
- $HOME/nats-server
66

77
python:
8+
- "3.8"
89
- "3.9"
910
- "3.10"
1011

@@ -83,7 +84,21 @@ jobs:
8384
- bash ./scripts/install_nats.sh
8485
install:
8586
- pip install -e .[fast-mail-parser]
87+
- name: "Python: 3.7"
88+
python: "3.7"
89+
before_install:
90+
- sudo apt update && sudo apt install gcc build-essential -y
91+
- sudo apt-get install python3-pip
92+
- sudo apt-get install python3-pytest
93+
- pip install --upgrade pip
94+
- bash ./scripts/install_nats.sh
95+
install:
96+
- pip install -e .[aiohttp,fast-mail-parser]
97+
script:
98+
- pytest -vv -s --continue-on-collection-errors tests
8699
allow_failures:
100+
- name: "Python: 3.7"
101+
- name: "Python: 3.8"
87102
- name: "Python: 3.11"
88103
- name: "Python: 3.11/uvloop"
89104
- name: "Python: 3.11 (nats-server@dev)"

nats/aio/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
)
6565
from .transport import TcpTransport, Transport, WebSocketTransport
6666

67-
__version__ = '2.3.1'
67+
__version__ = '2.4.0'
6868
__lang__ = 'python3'
6969
_logger = logging.getLogger(__name__)
7070
PROTOCOL = 1

pyproject.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ follow_imports = "silent"
4747
show_error_codes = true
4848
check_untyped_defs = false
4949

50-
[tool.pytest.ini_options]
51-
addopts = ["--cov=nats", "--cov-report=html"]
52-
5350
[tool.yapf]
5451
split_before_first_argument = true
5552
dedent_closing_brackets = true

tests/test_client.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ async def subscription_handler(msg):
348348

349349
async def subscription_handler2(msg):
350350
msgs2.append(msg)
351-
if len(msgs2) >= 1:
351+
if len(msgs2) >= 1 and not fut.done():
352352
fut.set_result(True)
353353

354354
await nc.connect(no_echo=True)
@@ -1274,8 +1274,6 @@ async def err_cb(e):
12741274

12751275
@async_test
12761276
async def test_closing_tasks(self):
1277-
nc = NATS()
1278-
12791277
disconnected_count = 0
12801278
errors = []
12811279
closed_future = asyncio.Future()
@@ -1298,12 +1296,11 @@ async def err_cb(e):
12981296
'disconnected_cb': disconnected_cb,
12991297
'error_cb': err_cb,
13001298
'closed_cb': closed_cb,
1301-
'servers': ["nats://foo:[email protected]:4223"],
13021299
'max_reconnect_attempts': 3,
13031300
'dont_randomize': True,
13041301
}
13051302

1306-
await nc.connect(**options)
1303+
nc = await nats.connect("nats://foo:[email protected]:4223", **options)
13071304
self.assertTrue(nc.is_connected)
13081305

13091306
# Do a sudden close and wrap up test.
@@ -1316,7 +1313,7 @@ async def err_cb(e):
13161313
for task in asyncio.all_tasks():
13171314
if not task.done():
13181315
pending_tasks_count += 1
1319-
self.assertEqual(expected_tasks, pending_tasks_count)
1316+
self.assertTrue(pending_tasks_count <= expected_tasks)
13201317

13211318
@async_test
13221319
async def test_pending_data_size_flush_reconnect(self):
@@ -2666,6 +2663,11 @@ async def test_protocol_mixing(self):
26662663

26672664
@async_test
26682665
async def test_drain_cancelled_errors_raised(self):
2666+
try:
2667+
from unittest.mock import AsyncMock
2668+
except ImportError:
2669+
pytest.skip("skip since cannot use AsyncMock")
2670+
26692671
nc = NATS()
26702672
await nc.connect()
26712673

tests/test_js.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,11 @@ async def error_cb(err):
740740

741741
@async_test
742742
async def test_fetch_cancelled_errors_raised(self):
743+
try:
744+
from unittest.mock import AsyncMock
745+
except ImportError:
746+
pytest.skip("skip since cannot use AsyncMock")
747+
743748
import tracemalloc
744749
tracemalloc.start()
745750

@@ -2717,9 +2722,11 @@ async def error_handler(e):
27172722
await kv.put("hello.world", b'Hello World!')
27182723
msg = await sub.next_msg()
27192724
assert msg.data == b''
2720-
assert len(msg.headers) == 5
2725+
assert msg.headers['Nats-Sequence'] == '1'
27212726
assert msg.headers['Nats-Msg-Size'] == '12'
2727+
assert msg.headers['Nats-Stream'] == 'KV_TEST_UPDATE_HEADERS'
27222728
await sub.unsubscribe()
2729+
await nc.close()
27232730

27242731

27252732
class ObjectStoreTest(SingleJetStreamServerTestCase):

0 commit comments

Comments
 (0)