Skip to content

Commit

Permalink
Release/v2.3.1 (#455)
Browse files Browse the repository at this point in the history
* Travis updates, bump client version

---------

Signed-off-by: Waldemar Quevedo <wally@nats.io>
  • Loading branch information
wallyqs authored Jun 4, 2023
1 parent eae396b commit 9ce2f4f
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 492 deletions.
35 changes: 31 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ cache:
python:
- "3.9"
- "3.10"
- "3.11"

before_install:
- bash ./scripts/install_nats.sh
Expand All @@ -16,7 +15,7 @@ before_script:
- export PATH=$HOME/nats-server:$PATH

install:
- pip install -e .[nkeys]
- pip install -e .[nkeys,aiohttp,fast-mail-parser]

script:
- make ci
Expand All @@ -25,14 +24,42 @@ notifications:
email: false

sudo: true
dist: focal
dist: jammy

jobs:
include:
- name: "Python: 3.12"
python: "3.12-dev"
before_install:
- sudo apt update && sudo apt install gcc build-essential -y
- sudo apt-get install python3-pip
- sudo apt-get install python3-pytest
- pip install --upgrade pip
- bash ./scripts/install_nats.sh
install:
- pip install -e .[fast-mail-parser]
- name: "Python: 3.11"
python: "3.11"
before_install:
- sudo apt update && sudo apt install gcc build-essential -y
- sudo apt-get install python3-pip
- sudo apt-get install python3-pytest
- pip install --upgrade pip
- bash ./scripts/install_nats.sh
install:
- pip install -e .[fast-mail-parser]
- name: "Python: 3.11/uvloop"
python: "3.11"
before_install:
- sudo apt update && sudo apt install gcc build-essential -y
- sudo apt-get install python3-pip
- sudo apt-get install python3-pytest
- pip install --upgrade pip
- bash ./scripts/install_nats.sh
install:
- pip install -e .[fast-mail-parser]
- pip install uvloop
allow_failures:
- python: "3.11"
- name: "Python: 3.11"
- name: "Python: 3.11/uvloop"
- name: "Python: 3.12"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ci: deps
pipenv run yapf --recursive --diff $(SOURCE_CODE)
pipenv run yapf --recursive --diff tests
# pipenv run mypy
pipenv run flake8 ./nats/js/
pipenv run flake8 --ignore=W391 ./nats/js/
pipenv run pytest -x -vv -s --continue-on-collection-errors

watch:
Expand Down
5 changes: 0 additions & 5 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,3 @@ pytest-cov = "*"
yapf = "*"
toml = "*" # see https://github.com/google/yapf/issues/936
exceptiongroup = "*"

[packages]
nkeys = "*"
aiohttp = "*"
fast-mail-parser = "*"
482 changes: 2 additions & 480 deletions Pipfile.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion nats/aio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
)
from .transport import TcpTransport, Transport, WebSocketTransport

__version__ = '2.3.0'
__version__ = '2.3.1'
__lang__ = 'python3'
_logger = logging.getLogger(__name__)
PROTOCOL = 1
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ classifiers = [
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10'
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11'
]

[project.urls]
Expand Down
19 changes: 19 additions & 0 deletions tests/test_client_websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,26 @@
import unittest
from unittest import mock

import pytest
import nats
from nats.aio.client import Client as NATS, __version__
from nats.aio.errors import *
from tests.utils import *

try:
import aiohttp
aiohttp_installed = True
except ModuleNotFoundError:
aiohttp_installed = False


class WebSocketTest(SingleWebSocketServerTestCase):

@async_test
async def test_simple_headers(self):
if not aiohttp_installed:
pytest.skip("aiohttp not installed")

nc = await nats.connect("ws://localhost:8080")

sub = await nc.subscribe("foo")
Expand All @@ -40,6 +50,9 @@ async def test_simple_headers(self):

@async_test
async def test_request_with_headers(self):
if not aiohttp_installed:
pytest.skip("aiohttp not installed")

nc = await nats.connect("ws://localhost:8080")

async def service(msg):
Expand Down Expand Up @@ -67,6 +80,9 @@ async def service(msg):

@async_test
async def test_empty_headers(self):
if not aiohttp_installed:
pytest.skip("aiohttp not installed")

nc = await nats.connect("ws://localhost:8080")

sub = await nc.subscribe("foo")
Expand Down Expand Up @@ -106,6 +122,9 @@ class WebSocketTLSTest(SingleWebSocketTLSServerTestCase):

@async_test
async def test_pub_sub(self):
if not aiohttp_installed:
pytest.skip("aiohttp not installed")

nc = await nats.connect("wss://localhost:8081", tls=self.ssl_ctx)

sub = await nc.subscribe("foo")
Expand Down
9 changes: 9 additions & 0 deletions tests/test_js.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
from nats.js.errors import *
from tests.utils import *

try:
from fast_mail_parser import parse_email
except ImportError:
parse_email = None


class PublishTest(SingleJetStreamServerTestCase):

Expand Down Expand Up @@ -643,6 +648,10 @@ async def test_fetch_headers(self):
assert msg.header['AAA-AAA-AAA'] == 'a'
assert msg.header['AAA-BBB-AAA'] == ''

if not parse_email:
await nc.close()
return

await js.publish(
"test.nats.1",
b'third_msg',
Expand Down

0 comments on commit 9ce2f4f

Please sign in to comment.