{"id":7541,"library":"pyats-easypy","title":"pyATS Easypy","description":"pyATS Easypy is the launcher and runtime environment for executing pyATS test scripts and harnesses. It provides jobfile parsing, plugin management, and the overall execution framework for network test automation. Part of the broader pyATS ecosystem from Cisco, it is actively maintained with frequent releases, currently at version 26.3, often following a monthly or bi-monthly cadence aligning with other pyATS components.","status":"active","version":"26.3","language":"en","source_language":"en","source_url":"https://github.com/CiscoDevNet/pyats","tags":["testing","network automation","cisco","pyats","test framework","ci/cd"],"install":[{"cmd":"pip install pyats-easypy","lang":"bash","label":"Install pyATS Easypy"}],"dependencies":[],"imports":[{"note":"While 'easypy' is the runner, test scripts themselves commonly import 'pyats.aetest' to define test cases and sections. Direct user-level Python imports from 'easypy' itself are rare as it's primarily a command-line utility and runtime.","symbol":"aetest","correct":"from pyats import aetest"},{"note":"For advanced use cases like programmatically launching Easypy or custom script execution, the 'main' function can be imported. However, typical usage is via the 'easypy' command-line.","wrong":"import easypy","symbol":"main","correct":"from pyats.easypy import main"}],"quickstart":{"code":"import os\nfrom pyats import aetest\n\nclass CommonSetup(aetest.CommonSetup):\n    @aetest.subsection\n    def initial_setup(self):\n        self.parent.parameters['example_param'] = 'Hello, pyATS!'\n        self.log.info(f\"Running initial setup with param: {self.parent.parameters['example_param']}\")\n\nclass Testcase1(aetest.Testcase):\n    @aetest.test\n    def example_test(self):\n        param = self.parent.parameters['example_param']\n        self.log.info(f\"Executing example_test with param: {param}\")\n        assert param == 'Hello, pyATS!'\n\nclass CommonCleanup(aetest.CommonCleanup):\n    @aetest.subsection\n    def final_cleanup(self):\n        self.log.info(\"Running final cleanup.\")\n\n# To run this script:\n# 1. Save it as e.g., `my_test.py`\n# 2. Run from your terminal: `easypy my_test.py`\n# Optional: To specify a testbed (e.g., if tests use device connections):\n#    `easypy my_test.py --testbed-file my_testbed.yaml`\n#    For quick demo, --testbed-file isn't strictly needed for this simple test.","lang":"python","description":"Create a simple AETest script and run it using the `easypy` command-line utility. The `easypy` command acts as the main runner for pyATS test jobs. This example demonstrates a basic test with CommonSetup, a Testcase, and CommonCleanup."},"warnings":[{"fix":"Review official pyATS release notes for specific schema and API changes. Update testbed files and custom plugins accordingly.","message":"Major pyATS versions (and thus pyats-easypy) can introduce breaking changes in testbed YAML schema or plugin APIs. Always consult release notes when upgrading across major versions (e.g., 24.x to 25.x).","severity":"breaking","affected_versions":"<26.0"},{"fix":"Ensure relevant `AE_` environment variables are correctly set before invoking `easypy`. Use `pyats clean` to manage old results directories if issues persist. For CI, explicitly define variables in the pipeline configuration.","message":"Easypy relies heavily on environment variables for configuration (e.g., `AE_TESTBED`, `AE_RESULTS_DIR`). Incorrectly set or missing environment variables can lead to unexpected behavior or failures, especially in CI/CD pipelines.","severity":"gotcha","affected_versions":"All"},{"fix":"Always use `easypy <your_test_script.py>` or `easypy <your_job_file.py>` to run pyATS tests. Do not execute AETest scripts directly with `python`.","message":"The `easypy` command-line tool requires an AETest script (or a job file) as an argument. Simply running `python your_script.py` for an AETest script will not invoke the Easypy runtime and its features (plugins, reporting, etc.).","severity":"gotcha","affected_versions":"All"},{"fix":"Upgrade your Python environment to 3.8 or newer. Check `requires_python` in PyPI metadata for the exact version.","message":"Older versions of pyATS might have supported Python 3.6 or 3.7, but current versions of `pyats-easypy` (26.x) explicitly require Python 3.8 and above. Attempting to install or run on older Python versions will fail.","severity":"deprecated","affected_versions":"<26.0"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Run `pip install pyats` or `pip install pyats.aetest` (if only the test framework is needed, though `pyats-easypy` might pull in core `pyats` anyway).","cause":"pyATS core package is not installed.","error":"ModuleNotFoundError: No module named 'pyats'"},{"fix":"Provide the path to your test script (e.g., `my_test.py`) or a job file (e.g., `my_job.py`) after the `easypy` command: `easypy my_test.py`.","cause":"No jobfile or test script was provided as an argument to `easypy`.","error":"Usage: easypy [options] <jobfile> [arguments]\nEasypy: error: the following arguments are required: jobfile"},{"fix":"Provide a valid testbed YAML file using the `--testbed-file` argument when running `easypy`, e.g., `easypy my_test.py --testbed-file /path/to/my_testbed.yaml`.","cause":"Your test script is attempting to access a testbed device (e.g., `self.runtime.testbed.devices`) but no testbed file was provided or it's invalid.","error":"KeyError: 'devices'"},{"fix":"Install the missing plugin package using pip (e.g., `pip install pyats.plugin.myplugin`) or ensure its path is correctly added to `PYTHONPATH` if it's a local module.","cause":"A custom pyATS plugin (or a plugin's dependency) specified in your environment or job file is not installed or discoverable.","error":"ERROR: Plugin 'X' failed to load: No module named 'Y'"}]}