Test Overview
This test checks if PyTest is installed correctly by running pytest --version in the command line and verifying the output shows the installed version.
This test checks if PyTest is installed correctly by running pytest --version in the command line and verifying the output shows the installed version.
import subprocess import sys def test_pytest_installation(): result = subprocess.run([sys.executable, '-m', 'pytest', '--version'], capture_output=True, text=True) output = result.stdout.strip() + result.stderr.strip() assert 'pytest' in output.lower() and 'version' in output.lower(), f"PyTest not found in output: {output}"
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts by running 'python -m pytest --version' command using subprocess | Command line environment ready, Python interpreter available | - | PASS |
| 2 | Captures the output from the command execution | Output contains PyTest version information if installed | - | PASS |
| 3 | Checks if output contains 'pytest' and 'version' keywords | Output string from command line | Assert output includes 'pytest' and 'version' | PASS |
| 4 | Test ends with PASS if assertion is true | PyTest is installed and recognized | - | PASS |