nvidia-nat-test 1.3.0rc5__py3-none-any.whl → 1.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of nvidia-nat-test might be problematic. Click here for more details.
- nat/test/plugin.py +131 -14
- {nvidia_nat_test-1.3.0rc5.dist-info → nvidia_nat_test-1.3.1.dist-info}/METADATA +2 -2
- {nvidia_nat_test-1.3.0rc5.dist-info → nvidia_nat_test-1.3.1.dist-info}/RECORD +8 -8
- {nvidia_nat_test-1.3.0rc5.dist-info → nvidia_nat_test-1.3.1.dist-info}/WHEEL +0 -0
- {nvidia_nat_test-1.3.0rc5.dist-info → nvidia_nat_test-1.3.1.dist-info}/entry_points.txt +0 -0
- {nvidia_nat_test-1.3.0rc5.dist-info → nvidia_nat_test-1.3.1.dist-info}/licenses/LICENSE-3rd-party.txt +0 -0
- {nvidia_nat_test-1.3.0rc5.dist-info → nvidia_nat_test-1.3.1.dist-info}/licenses/LICENSE.md +0 -0
- {nvidia_nat_test-1.3.0rc5.dist-info → nvidia_nat_test-1.3.1.dist-info}/top_level.txt +0 -0
nat/test/plugin.py
CHANGED
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
16
|
import os
|
|
17
|
+
import random
|
|
17
18
|
import subprocess
|
|
19
|
+
import time
|
|
18
20
|
import types
|
|
19
21
|
import typing
|
|
20
22
|
from collections.abc import AsyncGenerator
|
|
@@ -25,6 +27,8 @@ import pytest
|
|
|
25
27
|
import pytest_asyncio
|
|
26
28
|
|
|
27
29
|
if typing.TYPE_CHECKING:
|
|
30
|
+
import langsmith.client
|
|
31
|
+
|
|
28
32
|
from docker.client import DockerClient
|
|
29
33
|
|
|
30
34
|
|
|
@@ -220,7 +224,19 @@ def azure_openai_keys_fixture(fail_missing: bool):
|
|
|
220
224
|
yield require_env_variables(
|
|
221
225
|
varnames=["AZURE_OPENAI_API_KEY", "AZURE_OPENAI_ENDPOINT"],
|
|
222
226
|
reason="Azure integration tests require the `AZURE_OPENAI_API_KEY` and `AZURE_OPENAI_ENDPOINT` environment "
|
|
223
|
-
"
|
|
227
|
+
"variables to be defined.",
|
|
228
|
+
fail_missing=fail_missing)
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
@pytest.fixture(name="langfuse_keys", scope='session')
|
|
232
|
+
def langfuse_keys_fixture(fail_missing: bool):
|
|
233
|
+
"""
|
|
234
|
+
Use for integration tests that require Langfuse credentials.
|
|
235
|
+
"""
|
|
236
|
+
yield require_env_variables(
|
|
237
|
+
varnames=["LANGFUSE_PUBLIC_KEY", "LANGFUSE_SECRET_KEY"],
|
|
238
|
+
reason="Langfuse integration tests require the `LANGFUSE_PUBLIC_KEY` and `LANGFUSE_SECRET_KEY` environment "
|
|
239
|
+
"variables to be defined.",
|
|
224
240
|
fail_missing=fail_missing)
|
|
225
241
|
|
|
226
242
|
|
|
@@ -250,6 +266,40 @@ def require_weave_fixture(fail_missing: bool) -> types.ModuleType:
|
|
|
250
266
|
pytest.skip(reason=reason)
|
|
251
267
|
|
|
252
268
|
|
|
269
|
+
@pytest.fixture(name="langsmith_api_key", scope='session')
|
|
270
|
+
def langsmith_api_key_fixture(fail_missing: bool):
|
|
271
|
+
"""
|
|
272
|
+
Use for integration tests that require a LangSmith API key.
|
|
273
|
+
"""
|
|
274
|
+
yield require_env_variables(
|
|
275
|
+
varnames=["LANGSMITH_API_KEY"],
|
|
276
|
+
reason="LangSmith integration tests require the `LANGSMITH_API_KEY` environment variable to be defined.",
|
|
277
|
+
fail_missing=fail_missing)
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
@pytest.fixture(name="langsmith_client")
|
|
281
|
+
def langsmith_client_fixture(langsmith_api_key: str, fail_missing: bool) -> "langsmith.client.Client":
|
|
282
|
+
try:
|
|
283
|
+
import langsmith.client
|
|
284
|
+
client = langsmith.client.Client()
|
|
285
|
+
return client
|
|
286
|
+
except ImportError:
|
|
287
|
+
reason = "LangSmith integration tests require the `langsmith` package to be installed."
|
|
288
|
+
if fail_missing:
|
|
289
|
+
raise RuntimeError(reason)
|
|
290
|
+
pytest.skip(reason=reason)
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
@pytest.fixture(name="langsmith_project_name")
|
|
294
|
+
def langsmith_project_name_fixture(langsmith_client: "langsmith.client.Client") -> Generator[str]:
|
|
295
|
+
# Createa a unique project name for each test run
|
|
296
|
+
project_name = f"nat-e2e-test-{time.time()}-{random.random()}"
|
|
297
|
+
langsmith_client.create_project(project_name)
|
|
298
|
+
yield project_name
|
|
299
|
+
|
|
300
|
+
langsmith_client.delete_project(project_name=project_name)
|
|
301
|
+
|
|
302
|
+
|
|
253
303
|
@pytest.fixture(name="require_docker", scope='session')
|
|
254
304
|
def require_docker_fixture(fail_missing: bool) -> "DockerClient":
|
|
255
305
|
"""
|
|
@@ -291,8 +341,15 @@ def examples_dir_fixture(root_repo_dir: Path) -> Path:
|
|
|
291
341
|
return root_repo_dir / "examples"
|
|
292
342
|
|
|
293
343
|
|
|
294
|
-
@pytest.fixture(name="
|
|
295
|
-
def
|
|
344
|
+
@pytest.fixture(name="env_without_nat_log_level", scope='function')
|
|
345
|
+
def env_without_nat_log_level_fixture() -> dict[str, str]:
|
|
346
|
+
env = os.environ.copy()
|
|
347
|
+
env.pop("NAT_LOG_LEVEL", None)
|
|
348
|
+
return env
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
@pytest.fixture(name="etcd_url", scope="session")
|
|
352
|
+
def etcd_url_fixture(fail_missing: bool = False) -> str:
|
|
296
353
|
"""
|
|
297
354
|
To run these tests, an etcd server must be running
|
|
298
355
|
"""
|
|
@@ -300,21 +357,22 @@ def require_etcd_fixture(fail_missing: bool = False) -> bool:
|
|
|
300
357
|
|
|
301
358
|
host = os.getenv("NAT_CI_ETCD_HOST", "localhost")
|
|
302
359
|
port = os.getenv("NAT_CI_ETCD_PORT", "2379")
|
|
303
|
-
|
|
360
|
+
url = f"http://{host}:{port}"
|
|
361
|
+
health_url = f"{url}/health"
|
|
304
362
|
|
|
305
363
|
try:
|
|
306
364
|
response = requests.get(health_url, timeout=5)
|
|
307
365
|
response.raise_for_status()
|
|
308
|
-
return
|
|
366
|
+
return url
|
|
309
367
|
except: # noqa: E722
|
|
310
|
-
failure_reason = f"Unable to connect to etcd server at {
|
|
368
|
+
failure_reason = f"Unable to connect to etcd server at {url}"
|
|
311
369
|
if fail_missing:
|
|
312
370
|
raise RuntimeError(failure_reason)
|
|
313
371
|
pytest.skip(reason=failure_reason)
|
|
314
372
|
|
|
315
373
|
|
|
316
374
|
@pytest.fixture(name="milvus_uri", scope="session")
|
|
317
|
-
def milvus_uri_fixture(
|
|
375
|
+
def milvus_uri_fixture(etcd_url: str, fail_missing: bool = False) -> str:
|
|
318
376
|
"""
|
|
319
377
|
To run these tests, a Milvus server must be running
|
|
320
378
|
"""
|
|
@@ -445,7 +503,7 @@ def fixture_redis_server(fail_missing: bool) -> Generator[dict[str, str | int]]:
|
|
|
445
503
|
pytest.skip(f"Error connecting to Redis server: {e}, skipping redis tests")
|
|
446
504
|
|
|
447
505
|
|
|
448
|
-
@pytest_asyncio.fixture(name="mysql_server", scope="
|
|
506
|
+
@pytest_asyncio.fixture(name="mysql_server", scope="session")
|
|
449
507
|
async def fixture_mysql_server(fail_missing: bool) -> AsyncGenerator[dict[str, str | int]]:
|
|
450
508
|
"""Fixture to safely skip MySQL based tests if MySQL is not running"""
|
|
451
509
|
host = os.environ.get('NAT_CI_MYSQL_HOST', '127.0.0.1')
|
|
@@ -468,7 +526,7 @@ async def fixture_mysql_server(fail_missing: bool) -> AsyncGenerator[dict[str, s
|
|
|
468
526
|
pytest.skip(f"Error connecting to MySQL server: {e}, skipping MySQL tests")
|
|
469
527
|
|
|
470
528
|
|
|
471
|
-
@pytest.fixture(name="minio_server", scope="
|
|
529
|
+
@pytest.fixture(name="minio_server", scope="session")
|
|
472
530
|
def minio_server_fixture(fail_missing: bool) -> Generator[dict[str, str | int]]:
|
|
473
531
|
"""Fixture to safely skip MinIO based tests if MinIO is not running"""
|
|
474
532
|
host = os.getenv("NAT_CI_MINIO_HOST", "localhost")
|
|
@@ -495,17 +553,76 @@ def minio_server_fixture(fail_missing: bool) -> Generator[dict[str, str | int]]:
|
|
|
495
553
|
aws_access_key_id=aws_access_key_id,
|
|
496
554
|
aws_secret_access_key=aws_secret_access_key,
|
|
497
555
|
endpoint_url=endpoint_url)
|
|
498
|
-
client.
|
|
556
|
+
client.list_buckets()
|
|
499
557
|
yield minio_info
|
|
500
558
|
except ImportError:
|
|
501
559
|
if fail_missing:
|
|
502
560
|
raise
|
|
503
561
|
pytest.skip("aioboto3 not installed, skipping MinIO tests")
|
|
504
562
|
except Exception as e:
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
563
|
+
if fail_missing:
|
|
564
|
+
raise
|
|
565
|
+
else:
|
|
566
|
+
pytest.skip(f"Error connecting to MinIO server: {e}, skipping MinIO tests")
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
@pytest.fixture(name="langfuse_bucket", scope="session")
|
|
570
|
+
def langfuse_bucket_fixture(fail_missing: bool, minio_server: dict[str, str | int]) -> Generator[str]:
|
|
571
|
+
|
|
572
|
+
bucket_name = os.getenv("NAT_CI_LANGFUSE_BUCKET", "langfuse")
|
|
573
|
+
try:
|
|
574
|
+
import botocore.session
|
|
575
|
+
session = botocore.session.get_session()
|
|
576
|
+
|
|
577
|
+
client = session.create_client("s3",
|
|
578
|
+
aws_access_key_id=minio_server["aws_access_key_id"],
|
|
579
|
+
aws_secret_access_key=minio_server["aws_secret_access_key"],
|
|
580
|
+
endpoint_url=minio_server["endpoint_url"])
|
|
581
|
+
|
|
582
|
+
buckets = client.list_buckets()
|
|
583
|
+
bucket_names = [b['Name'] for b in buckets['Buckets']]
|
|
584
|
+
if bucket_name not in bucket_names:
|
|
585
|
+
client.create_bucket(Bucket=bucket_name)
|
|
586
|
+
|
|
587
|
+
yield bucket_name
|
|
588
|
+
except ImportError:
|
|
589
|
+
if fail_missing:
|
|
590
|
+
raise
|
|
591
|
+
pytest.skip("aioboto3 not installed, skipping MinIO tests")
|
|
592
|
+
except Exception as e:
|
|
593
|
+
if fail_missing:
|
|
509
594
|
raise
|
|
510
595
|
else:
|
|
511
596
|
pytest.skip(f"Error connecting to MinIO server: {e}, skipping MinIO tests")
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
@pytest.fixture(name="langfuse_url", scope="session")
|
|
600
|
+
def langfuse_url_fixture(fail_missing: bool, langfuse_bucket: str) -> str:
|
|
601
|
+
"""
|
|
602
|
+
To run these tests, a langfuse server must be running.
|
|
603
|
+
"""
|
|
604
|
+
import requests
|
|
605
|
+
|
|
606
|
+
host = os.getenv("NAT_CI_LANGFUSE_HOST", "localhost")
|
|
607
|
+
port = int(os.getenv("NAT_CI_LANGFUSE_PORT", "3000"))
|
|
608
|
+
url = f"http://{host}:{port}"
|
|
609
|
+
health_endpoint = f"{url}/api/public/health"
|
|
610
|
+
try:
|
|
611
|
+
response = requests.get(health_endpoint, timeout=5)
|
|
612
|
+
response.raise_for_status()
|
|
613
|
+
|
|
614
|
+
return url
|
|
615
|
+
except Exception as e:
|
|
616
|
+
reason = f"Unable to connect to Langfuse server at {url}: {e}"
|
|
617
|
+
if fail_missing:
|
|
618
|
+
raise RuntimeError(reason)
|
|
619
|
+
pytest.skip(reason=reason)
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
@pytest.fixture(name="langfuse_trace_url", scope="session")
|
|
623
|
+
def langfuse_trace_url_fixture(langfuse_url: str) -> str:
|
|
624
|
+
"""
|
|
625
|
+
The langfuse_url fixture provides the base url, however the general.telemetry.tracing["langfuse"].endpoint expects
|
|
626
|
+
the trace url which is what this fixture provides.
|
|
627
|
+
"""
|
|
628
|
+
return f"{langfuse_url}/api/public/otel/v1/traces"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nvidia-nat-test
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.1
|
|
4
4
|
Summary: Testing utilities for NeMo Agent toolkit
|
|
5
5
|
Author: NVIDIA Corporation
|
|
6
6
|
Maintainer: NVIDIA Corporation
|
|
@@ -16,7 +16,7 @@ Requires-Python: <3.14,>=3.11
|
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE-3rd-party.txt
|
|
18
18
|
License-File: LICENSE.md
|
|
19
|
-
Requires-Dist: nvidia-nat==v1.3.
|
|
19
|
+
Requires-Dist: nvidia-nat==v1.3.1
|
|
20
20
|
Requires-Dist: langchain-community~=0.3
|
|
21
21
|
Requires-Dist: pytest~=8.3
|
|
22
22
|
Dynamic: license-file
|
|
@@ -5,14 +5,14 @@ nat/test/functions.py,sha256=ZxXVzfaLBGOpR5qtmMrKU7q-M9-vVGGj3Xi5mrw4vHY,3557
|
|
|
5
5
|
nat/test/llm.py,sha256=f6bz6arAQjhjuOKFrLfu_U1LbiyFzQmpM-q8b-WKSrU,9550
|
|
6
6
|
nat/test/memory.py,sha256=xki_A2yiMhEZuQk60K7t04QRqf32nQqnfzD5Iv7fkvw,1456
|
|
7
7
|
nat/test/object_store_tests.py,sha256=PyJioOtoSzILPq6LuD-sOZ_89PIcgXWZweoHBQpK2zQ,4281
|
|
8
|
-
nat/test/plugin.py,sha256=
|
|
8
|
+
nat/test/plugin.py,sha256=VbKEduSIll8TlyKQtLX5LJ0LzCyXQDwCTxeirZKnrMY,22257
|
|
9
9
|
nat/test/register.py,sha256=o1BEA5fyxyFyCxXhQ6ArmtuNpgRyTEfvw6HdBgECPLI,897
|
|
10
10
|
nat/test/tool_test_runner.py,sha256=SxavwXHkvCQDl_PUiiiqgvGfexKJJTeBdI5i1qk6AzI,21712
|
|
11
11
|
nat/test/utils.py,sha256=Lml187P9SUP3IB_HhBaU1XNhiljcpOFFZOAxgQR1vQo,5936
|
|
12
|
-
nvidia_nat_test-1.3.
|
|
13
|
-
nvidia_nat_test-1.3.
|
|
14
|
-
nvidia_nat_test-1.3.
|
|
15
|
-
nvidia_nat_test-1.3.
|
|
16
|
-
nvidia_nat_test-1.3.
|
|
17
|
-
nvidia_nat_test-1.3.
|
|
18
|
-
nvidia_nat_test-1.3.
|
|
12
|
+
nvidia_nat_test-1.3.1.dist-info/licenses/LICENSE-3rd-party.txt,sha256=fOk5jMmCX9YoKWyYzTtfgl-SUy477audFC5hNY4oP7Q,284609
|
|
13
|
+
nvidia_nat_test-1.3.1.dist-info/licenses/LICENSE.md,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
14
|
+
nvidia_nat_test-1.3.1.dist-info/METADATA,sha256=mvvslkcIuYF2kaoSlhTon8Wx-UeKVzfCSDlIUkpDBnI,1907
|
|
15
|
+
nvidia_nat_test-1.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
16
|
+
nvidia_nat_test-1.3.1.dist-info/entry_points.txt,sha256=7dOP9XB6iMDqvav3gYx9VWUwA8RrFzhbAa8nGeC8e4Y,99
|
|
17
|
+
nvidia_nat_test-1.3.1.dist-info/top_level.txt,sha256=8-CJ2cP6-f0ZReXe5Hzqp-5pvzzHz-5Ds5H2bGqh1-U,4
|
|
18
|
+
nvidia_nat_test-1.3.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|