def run_bamboo(pkg, work_dir, branch = None, test_group = None, test_list= None, test_paths = [], test_config_path=None, ncores=2, verbosity=False, pmode=None, tests_to_ignore=None, merge_target=None):
import os, sys, re, json, unittest, shlex
import argparse, subprocess, traceback
import shutil, datetime, platform
import xml.etree.ElementTree as ET
def write_conftest(filepath):
Generates and writes a pytest configuration file to the specified filepath.
This function creates a pytest configuration file (`conftest.py`) with
specific setup based on the operating system. The generated configuration
includes necessary imports and a pytest configuration function that registers
a `TestDescriptionPlugin`. The content differs slightly for Linux and Darwin
filepath (str): The path where the `conftest.py` file will be written.
- For Darwin (macOS), the configuration attempts to unregister the
`TestDescriptionPlugin` before registering it again.
- For Linux, the configuration directly registers the `TestDescriptionPlugin`.
if platform.system() == 'Darwin':
if platform_os == 'Darwin':
def pytest_configure(config):
terminal_reporter = config.pluginmanager.getplugin('terminalreporter')
config.pluginmanager.unregister(TestDescriptionPlugin(terminal_reporter), 'testdescription')
config.pluginmanager.register(TestDescriptionPlugin(terminal_reporter), 'testdescription')
if platform_os == 'Linux':
def pytest_configure(config):
terminal_reporter = config.pluginmanager.getplugin('terminalreporter')
config.pluginmanager.register(TestDescriptionPlugin(terminal_reporter), 'testdescription')
class TestDescriptionPlugin:
def __init__(self, terminal_reporter):
self.terminal_reporter = terminal_reporter
def pytest_runtest_protocol(self, item):
#from pprint import pprint