##### SUMMARY

Support collection roles as integration test targets.

Now that https://github.com/ansible/ansible/issues/59462 has been merged, ansible-test can be updated to support running integration test targets that are collection roles.

The planned convention is to look for targets under `roles/test/` and allow use of target-specific plugins from `plugins/{plugin_type}/test/{target_name}/`.

##### ISSUE TYPE

Feature Idea

##### COMPONENT NAME

ansible-test

##### ADDITIONAL INFORMATION

This will allow integration test targets to be written using collections instead of pre-collection roles.
"""Write the given text content to the specified test results path, creating directories as needed."""
    path = os.path.join(category.path, name)
    write_text_file(path, content, create_directories=True)
def write_json_file(path, content, create_directories=False):  
    """Write the given json content to the specified path, optionally creating missing directories."""
    text_content = json.dumps(content, sort_keys=True, indent=4) + '\n'
    write_text_file(path, text_content, create_directories=create_directories)
def write_text_file(path, content, create_directories=False):  
    """Write the given text content to the specified path, optionally creating missing directories."""
    if create_directories:
        make_dirs(os.path.dirname(path))
    with open(to_bytes(path), 'wb') as file:
        file.write(to_bytes(content))
def get_python_path(args, interpreter):
    """
    :type args: TestConfig
    :type interpreter: str
    :rtype: str
    """
    
    
    if os.path.basename(interpreter) == 'python':
        return os.path.dirname(interpreter)
    python_path = PYTHON_PATHS.get(interpreter)
    if python_path:
        return python_path
    prefix = 'python-'