python-tests

द्वारा nvidia

NeMo Fabric के लिए Python टेस्ट; टेस्ट लिखते समय इसका उपयोग करें

npx skills add https://github.com/nvidia/nemo-fabric --skill python-tests

Python Test Style

  • Pytest is used to run tests.
  • Do not add @pytest.mark.asyncio to any test. Async tests are automatically detected and run by the async runner; the decorator is unnecessary clutter.
  • Do not add a -> None return type annotation to test functions. This is not a common convention in pytest and adds unnecessary verbosity.
  • When mocking a class, do not define a new class. Use unittest.mock.MagicMock or unittest.mock.AsyncMock, with the spec constructor argument when necessary.
  • The name of the mocked class should be prefixed with mock, not fake.
  • Prefer pytest fixtures over helper methods.
  • Do not repeat fixtures, if a fixture is needed in multiple test files, place it in a conftest.py file.
  • When creating a fixture follow this pattern:
    @pytest.fixture(name="<fixture_name>"[, scope="<scope>"])
    def <fixture_name>_fixture() -> <return_type>:
        ...
    
    Only specify the scope argument when the value is something other than "function".
  • Prefer pytest.mark.parametrize over creating individual tests for different input types.
  • If a fixture is needed for a test, but either does not return a value or the value is not used in the test, use the @pytest.mark.usefixtures decorator.
  • tests/conftest.py contains a restore_environ_fixture fixture that restores the environment variables to their original state after each test, it is defined with autouse=True so it is automatically applied to all tests. If you need to modify the environment variables in a test, do so using os.environ and the fixture will restore them after the test completes. There is no need to use monkeypatch.setenv to modify environment variables in tests.
  • Avoid defensive programming in tests. If a test fails, it should fail loudly and clearly, rather than silently passing due to defensive checks. For example
    data = results["data"]
    
    is preferred over
    data = results.get("data")
    
    Simply allow the resulting KeyError to be raised if the "data" key is not present in the results dictionary, as this will provide a clear indication of what went wrong in the test.

Common Commands

# Focused test loop
uv run pytest -k "<pattern>"

# Run all tests
uv run pytest

Do Not Write Tests For

  • Documentation.
  • Test helper code under tests/_utils/.
  • Package metadata or wheel installation behavior.

References

  • pyproject.toml
  • tests/conftest.py

nvidia की और Skills

compileiq-debug
nvidia
उपयोग करें जब कुछ गलत हो: Search() हैंग हो जाता है, सभी मूल्यांकन INVALID_SCORE लौटाते हैं, स्कोर में सुधार नहीं हो रहा है, हर कॉन्फ़िगरेशन एक ही संख्या लौटाता है, ptxas त्रुटियाँ…
create-github-pr
nvidia
gh CLI का उपयोग करके GitHub पुल रिक्वेस्ट बनाएँ। जब उपयोगकर्ता नया PR बनाना चाहता है, कोड समीक्षा के लिए सबमिट करना चाहता है, या पुल रिक्वेस्ट खोलना चाहता है, तब उपयोग करें। ट्रिगर कीवर्ड -…
nemoclaw-maintainer-cross-issue-sweep
nvidia
अन्य खुले मुद्दों को स्कैन करता है ताकि उन मुद्दों को ढूंढ सके जिन्हें कोई दिया गया PR ठीक कर सकता है या गलती से तोड़ सकता है। आसन्न-सुधार अवसरों और विरोधाभास जोखिमों को file:line… के साथ आउटपुट करता है।
fhir-basics
nvidia
एजेंटों को सिखाता है कि FHIR R4 APIs कैसे काम करते हैं, कौन से संसाधन उपलब्ध हैं, उन्हें खोज मापदंडों के साथ कैसे क्वेरी करें, और सभी प्रतिक्रिया प्रारूपों को सही ढंग से कैसे पार्स करें…
compileiq-validate-result
nvidia
खोज पूरी होने के बाद और किसी स्पीडअप का दावा करने या ACF भेजने से पहले उपयोग करें। dump_results CSV लोड करता है, शीर्ष-K उम्मीदवारों (एकल-उद्देश्य) को निकालता है…
changelog-audit
nvidia
रिलीज़ से पहले Warp CHANGELOG.md का ऑडिट करें: खोई हुई प्रविष्टियाँ पुनर्प्राप्त करें, उपयोगकर्ता प्रभाव के अनुसार क्रमबद्ध करें, प्रविष्टि भाषा को परिष्कृत करें, लाइन-रैप करें, और (रिलीज़-ब्रांच मोड) तुलना बढ़ाएँ…
maintain-dynamic-plugins
nvidia
NeMo Relay डायनामिक प्लगइन लोडर, मैनिफेस्ट, रस्ट नेटिव SDK, gRPC वर्कर प्रोटोकॉल, पायथन वर्कर SDK, दस्तावेज़, परीक्षण और रिलीज़ वर्कफ़्लो कवरेज बनाए रखें
dgx-diagnose
nvidia
सामान्य DGX Station GB300 समस्याओं का निदान करें — CUDA क्रैश, गलत-GPU लक्ष्यीकरण, vLLM/SGLang कंटेनर बग, MIG स्थिति समस्याएं, NVLink/Fabric Manager त्रुटियां,…