Skip to content

Commit

Permalink
Add nats-py dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
bstrausser committed Mar 30, 2024
1 parent 16bf62d commit f830323
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
12 changes: 2 additions & 10 deletions modules/nats/tests/test_nats.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,8 @@
"""


NO_NATS_CLIENT = True
try:
from nats import connect as nats_connect
from nats.aio.client import Client as NATSClient

NO_NATS_CLIENT = False
except ImportError:
pass
from nats import connect as nats_connect
from nats.aio.client import Client as NATSClient


async def get_client(container: NatsContainer) -> "NATSClient":
Expand Down Expand Up @@ -50,7 +44,6 @@ def test_basic_container_ops():
pytest.mark.usefixtures("anyio_backend")


@pytest.mark.skipif(NO_NATS_CLIENT, reason="No NATS Client Available")
@pytest.mark.parametrize("anyio_backend", ["asyncio"])
async def test_pubsub(anyio_backend):
with NatsContainer() as container:
Expand All @@ -72,7 +65,6 @@ async def test_pubsub(anyio_backend):


@pytest.mark.parametrize("anyio_backend", ["asyncio"])
@pytest.mark.skipif(NO_NATS_CLIENT, reason="No NATS Client Available")
async def test_more_complex_example(anyio_backend):
with NatsContainer() as container:
nc: NATSClient = await get_client(container)
Expand Down
18 changes: 17 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ pyyaml = { version = "*", optional = true }
python-keycloak = { version = "*", optional = true }
boto3 = { version = "*", optional = true }
minio = { version = "*", optional = true }
nats-py = { version = "*", optional = true }
pymongo = { version = "*", optional = true }
sqlalchemy = { version = "*", optional = true }
pymssql = { version = "*", optional = true }
Expand Down Expand Up @@ -110,6 +111,7 @@ minio = ["minio"]
mongodb = ["pymongo"]
mssql = ["sqlalchemy", "pymssql"]
mysql = ["sqlalchemy", "pymysql"]
nats = ["nats-py"]
neo4j = ["neo4j"]
nginx = []
opensearch = ["opensearch-py"]
Expand Down

0 comments on commit f830323

Please sign in to comment.