Package: pytest-collect-formatter2
========================
pytest-collect-formatter2Fork From:https://github.com/LaserPhaser/pytest-collect-formatteradd remark collectPytest plugin for formatting output of the collected tests.Free software: MIT licenseRequirementspyyamldicttoxmlInstallationYou can install "pytest-collect-formatter2" viapip_::$ pip install pytest-collect-formatter2UsageUse this plugin by running pytest normally and use the following options to customize collection format,
it's better to use with--collect-onlyoptioncollect-formatter:
--collect-output-file=COLLECT_OUTPUT_FILE
Saves collected test items to the file
--collect-format=COLLECT_FORMAT
Saves collected test items specified format [xml, yaml, json]
--collect-type=COLLECT_TYPE
Format output results in classic pytest view or in 'path' view [classic, path], default classic
--with-remark
Collect method remark,priority:1st-@allure.title() 2nd-method python doc 3rd- method commentExample of usage$ pytest tests --collect-output-file my_tests_structure.xml --collect-format xmlAnd you will get the my_tests_structure.xmlExmpales of formatsPATHJSON.. code-block::[
    {
        "type": "Module",
        "title": "examples/tests/test_formatter/test_fromatter_v1.py",
        "children": [
            {
                "type": "Class",
                "title": "TestFormatter",
                "children": [
                    {
                        "type": "Function",
                        "title": "test_inside_class",
                        "remark": "this is remark"
                    },
                    {
                        "type": "Function",
                        "title": "test_inside_class_parametrize[1]",
                        "remark": null
                    },
                    {
                        "type": "Function",
                        "title": "test_inside_class_parametrize[2]",
                        "remark": null
                    },
                    {
                        "type": "Function",
                        "title": "test_inside_class_parametrize[3]",
                        "remark": null
                    },
                    {
                        "type": "Function",
                        "title": "test_inside_class_parametrize[4]",
                        "remark": null
                    }
                ],
                "remark": null
            },
            {
                "type": "Function",
                "title": "test_outside_of_class",
                "remark": "this is remark 3"
            }
        ],
        "remark": null
    }
]YAML.. code-block::- children:
  - children:
    - children:
      - children:
        - children:
          - children: []
            title: test_inside_class
            type: pytest_unit
          - children: []
            title: test_inside_class_parametrize[1]
            type: pytest_unit
          - children: []
            title: test_inside_class_parametrize[2]
            type: pytest_unit
          - children: []
            title: test_inside_class_parametrize[3]...XML.. code-block::<?xml version="1.0" ?>
<root>
    <item>
        <type>path</type>
        <title>examples</title>
        <children>
            <item>
                <type>path</type>
                <title>tests</title>
                <children>
                    <item>
                        <type>path</type>
                        <title>test_formatter</title>
                        <children>
                            <item>
                                <type>path</type>
                                <title>test_fromatter_v1.py</title>
                                <children>
                                    <item>
                                        <type>pytest_unit</type>
                                        <title>TestFormatter</title>
                                        <children>
                                            <item>
                                                <type>pytest_unit</type>
                                                <title>test_inside_class</title>
                                                <children/>
                                            </item>
...CLASSICJSON.. code-block::[
{
"type": "Package",
"value": "test_formatter",
"children": [
{
"type": "Module",
"value": "test_fromatter_v1.py",
"children": [
{
"type": "Class",
"value": "TestFormatter",
"children": [
{
"type": "Function",
"value": "test_inside_class"
}
....YAML.. code-block::- children:
  - children:
    - children:
      - type: Function
        value: test_inside_class
      - type: Function
        value: test_inside_class_parametrize[1]
      - type: Function
        value: test_inside_class_parametrize[2]
      - type: Function
        value: test_inside_class_parametrize[3]
      - type: Function
        value: test_inside_class_parametrize[4]
      type: Class
      value: TestFormatter
    - type: Function
      value: test_outside_of_class
    type: Module
    value: test_fromatter_v1.py
  type: Package
  value: test_formatter
....XML.. code-block::<?xml version="1.0" ?>
<root>
    <item>
        <type>Package</type>
        <value>test_formatter</value>
        <children>
            <item>
                <type>Module</type>
                <value>test_fromatter_v1.py</value>
                <children>
                    <item>
                        <type>Class</type>
                        <value>TestFormatter</value>
                        <children>
                            <item>
                                <type>Function</type>
                                <value>test_inside_class</value>
                            </item>
                            <item>
                                <type>Function</type>
                                <value>test_inside_class_parametrize[1]</value>
                            </item>
                            <item>
                                <type>Function</type>
                                <value>test_inside_class_parametrize[2]</value>
                            </item>
                            <item>
                                <type>Function</type>
                                <value>test_inside_class_parametrize[3]</value>
                            </item>
                            <item>
                                <type>Function</type>
                                <value>test_inside_class_parametrize[4]</value>
                            </item>
                        </children>
                    </item>
                    <item>
                        <type>Function</type>
                        <value>test_outside_of_class</value>
                    </item>
                </children>
            </item>
        </children>
....More examples could be found in examples folder as well as tests structureIssuesIf you encounter any problems, pleasefile an issue_ along with a detailed description.Credits.. _file an issue:https://github.com/pytest-dev/pytest-slack/issues.. _pip:https://pypi.python.org/pypi/pip/=======
CreditsDevelopment LeadLaser <https://github.com/LaserPhaser>_Contributors