{"id":7544,"library":"pyats-results","title":"pyATS Results","description":"pyATS Results is a core component of the Cisco pyATS framework, providing an object-oriented API for representing and managing test execution results such as Pass, Fail, Warn, Error, and others. It ensures consistent handling and reporting across various test scenarios within the pyATS ecosystem. As of version 26.3, it is actively maintained with frequent releases aligned with the broader pyATS framework, typically on a monthly cadence.","status":"active","version":"26.3","language":"en","source_language":"en","source_url":"https://github.com/CiscoTestAutomation/pyats","tags":["testing","test-automation","results","pyats","cisco"],"install":[{"cmd":"pip install pyats-results","lang":"bash","label":"Install pyats-results"},{"cmd":"pip install pyats","lang":"bash","label":"Install complete pyATS framework (includes pyats-results)"}],"dependencies":[],"imports":[{"symbol":"Result","correct":"from pyats.results import Result"},{"symbol":"Pass","correct":"from pyats.results import Pass"},{"symbol":"Fail","correct":"from pyats.results import Fail"},{"symbol":"Warn","correct":"from pyats.results import Warn"},{"symbol":"Error","correct":"from pyats.results import Error"}],"quickstart":{"code":"from pyats.results import Pass, Fail, Result\n\ndef run_my_test_example():\n    # Example 1: Using specific result classes\n    test_case_status = True\n    if test_case_status:\n        result1 = Pass('Scenario A completed successfully.')\n    else:\n        result1 = Fail('Scenario A encountered a critical error.')\n\n    # Example 2: Using the base Result class and setting its state\n    result2 = Result()\n    result2.state = 'Blocked'\n    result2.message = 'Scenario B was blocked by a previous failure.'\n\n    # Example 3: Instantiating a warning\n    result3 = Result()\n    result3.state = 'Warning'\n    result3.message = 'Scenario C completed with minor warnings.'\n\n    print(f\"Test 1: {result1.state} - {result1.message}\")\n    print(f\"Test 2: {result2.state} - {result2.message}\")\n    print(f\"Test 3: {result3.state} - {result3.message}\")\n\n    # Assertions for quickstart validation\n    assert result1.state == 'Passed'\n    assert result2.state == 'Blocked'\n    assert result3.state == 'Warning'\n\nif __name__ == \"__main__\":\n    run_my_test_example()","lang":"python","description":"This quickstart demonstrates how to instantiate and use `pyats.results` objects to represent different test outcomes. It shows creating specific result types like `Pass` and `Fail`, as well as using the base `Result` class to explicitly set a state like 'Blocked' or 'Warning'."},"warnings":[{"fix":"Always install or upgrade all `pyats` related packages together. The recommended approach is to `pip install pyats` which pulls compatible dependencies, or explicitly specify versions consistent with the official pyATS release notes.","message":"All pyATS core components (e.g., `pyats`, `pyats.topology`, `pyats.results`, `pyats.aereports`) must be installed with compatible versions. Mismatched versions, especially across major releases, can lead to subtle bugs or unexpected runtime errors due to internal API changes.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use the dedicated result classes (`Pass`, `Fail`, `Warn`, `Error`, etc.) when possible, or ensure direct assignments to `result.state` strictly adhere to the official pyATS result state strings, including capitalization. Refer to pyATS documentation for the full list of valid states.","message":"The `state` attribute of `Result` objects is case-sensitive and expects specific string values (e.g., 'Passed', 'Failed', 'Warning', 'Aborted', 'Blocked', 'Errored', 'Skipped', 'PostProcessor'). Assigning non-standard or incorrectly cased strings can lead to issues with downstream reporting tools or integrations that rely on these predefined states.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Install the package using `pip install pyats-results` if you only need the results component, or `pip install pyats` to get the entire framework along with `pyats-results`.","cause":"The `pyats-results` package or the broader `pyATS` framework is not installed in your Python environment.","error":"ModuleNotFoundError: No module named 'pyats.results'"},{"fix":"Use `result.state` to get or set the result's state (e.g., 'Passed', 'Failed'). The `status` attribute is not part of the `pyats.results.Result` API.","cause":"Attempting to access a `status` attribute on a `pyats.results.Result` object, which does not exist.","error":"AttributeError: 'Result' object has no attribute 'status'"},{"fix":"Ensure you are either calling the result class constructor with no arguments if you intend to set the message later (`result = Pass(); result.message = '...'`) or provide a single string message argument (`result = Pass('My test message')`). Consult the specific pyATS version's documentation for exact constructor signatures.","cause":"While `Pass()`, `Fail()`, etc., can take an optional `message` argument, if a downstream custom class or an older version of the API expected a message, calling it without one could lead to this error. More commonly, trying to pass too many arguments or incorrect types.","error":"TypeError: Pass() missing 1 required positional argument: 'message'"}]}