{"id":10182,"library":"qase-python-commons","title":"Qase Python Commons","description":"qase-python-commons is a foundational Python library providing common models, data structures, and utilities used across various Qase TestOps integration tools, such as reporters for Pytest, Behave, and Robot Framework. It streamlines data exchange and standardizes reporting formats for Qase TestOps. The current version is 5.1.1, and it's actively maintained with frequent updates, often alongside its sister reporter libraries.","status":"active","version":"5.1.1","language":"en","source_language":"en","source_url":"https://github.com/qase-tms/qase-python/tree/main/qase-python-commons","tags":["Qase","testing","test management","utilities","reporting","commons"],"install":[{"cmd":"pip install qase-python-commons","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Provides core API client functionalities for Qase TestOps integration.","package":"qase-api-client","optional":false},{"reason":"Used for data validation and settings management within the library's models.","package":"pydantic","optional":false}],"imports":[{"symbol":"Result","correct":"from qaseio.commons.models import Result"},{"symbol":"Status","correct":"from qaseio.commons.models import Status"},{"symbol":"Step","correct":"from qaseio.commons.models import Step"}],"quickstart":{"code":"from qaseio.commons.models import Result, Step, Status\nimport datetime\n\n# Create a test result object\nresult = Result(\n    test_id='QASE-123',\n    status=Status.PASSED,\n    start_time=datetime.datetime.now().isoformat(),\n    end_time=datetime.datetime.now().isoformat(),\n    duration=150, # milliseconds\n    message='Simple test passed.'\n)\n\n# Add a step to the test result\nstep1 = Step(\n    status=Status.PASSED,\n    position=1,\n    action='Verify initial setup',\n    start_time=datetime.datetime.now().isoformat(),\n    end_time=datetime.datetime.now().isoformat(),\n    duration=100\n)\nresult.steps.append(step1)\n\n# Add tags to the result\nresult.add_tag('smoke_test')\nresult.add_tag('frontend')\n\nprint(f\"Result created for Test ID: {result.test_id}\")\nprint(f\"Status: {result.status.value}\")\nprint(f\"Duration: {result.duration}ms\")\nprint(f\"Tags: {', '.join(result.tags)}\")\nprint(f\"Number of steps: {len(result.steps)}\")","lang":"python","description":"This quickstart demonstrates how to instantiate and populate core data models like `Result` and `Step` using `qaseio.commons.models`. These objects form the basis for reporting test results to Qase TestOps via various reporter libraries."},"warnings":[{"fix":"Ensure you are using the `add_tag()` method for adding tags to `Result` objects and accessing tags via `result.tags` attribute. Review custom code that interacts with test tags.","message":"The handling of test-level tags was refactored in versions 5.1.0/5.1.1. Previously, custom integrations might have directly manipulated tag fields. Now, `add_tag()` and `tags` attribute on the `Result` model should be used.","severity":"breaking","affected_versions":">=5.1.0"},{"fix":"Ensure your project uses Pydantic v1.x (e.g., `pip install 'pydantic<2.0'`) or create a dedicated virtual environment for projects using `qase-python-commons` to manage its dependencies correctly.","message":"This library explicitly depends on `pydantic<3.0.0`. If you have Pydantic v2.x installed globally or in your environment for other projects, it might lead to dependency resolution errors or runtime issues due to API differences between Pydantic v1 and v2.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Install the library using `pip install qase-python-commons` and ensure your Python environment is correctly configured.","cause":"The `qase-python-commons` library is not installed or the virtual environment is not activated.","error":"ModuleNotFoundError: No module named 'qaseio.commons'"},{"fix":"Review the constructor arguments for `Result` and `Step` models. Ensure all required fields are present and their values match the expected data types (e.g., ISO-formatted strings for times, `Status` enum for status).","cause":"When creating `Result` or `Step` models, a required field (e.g., `test_id`, `status`, `start_time`) was omitted or provided with an incorrect type, failing Pydantic validation.","error":"pydantic.error_wrappers.ValidationError: ... field required"}]}