tasks/libs/junit_upload.py
def junit_upload_from_tgz(junit_tgz, codeowners_path=".github/CODEOWNERS"):
    """
    Upload all JUnit XML files contained in given tgz archive.
    """
    from codeowners import CodeOwners

    with open(codeowners_path) as f:
        codeowners = CodeOwners(f.read())

    with tempfile.TemporaryDirectory() as unpack_dir:
        # unpack all files from archive
        with tarfile.open(junit_tgz) as tgz:
            tgz.extractall(path=unpack_dir)
        # read additional tags
        with open(os.path.join(unpack_dir, TAGS_FILE_NAME)) as tf:
            tags = tf.read().split()
        # read job url (see comment in produce_junit_tar)
        with open(os.path.join(unpack_dir, JOB_URL_FILE_NAME)) as jf:
            job_url = jf.read()

        # for each unpacked xml file, split it and submit all parts
        for xmlfile in glob.glob(f"{unpack_dir}/*.xml"):
            with tempfile.TemporaryDirectory() as output_dir:
                written_owners = split_junitxml(xmlfile, codeowners, output_dir)
                upload_junitxmls(output_dir, written_owners, tags, job_url)

    Upload all JUnit XML files contained in given tgz archive.
    
Upload all JUnit XML files contained in given tgz archive.
Upload all JUnit XML files contained in given tgz archive .
def junit_upload_from_tgz(junit_tgz, codeowners_path=".github/CODEOWNERS"):
    from codeowners import CodeOwners
    with open(codeowners_path) as f:
        codeowners = CodeOwners(f.read())
    with tempfile.TemporaryDirectory() as unpack_dir:
        with tarfile.open(junit_tgz) as tgz:
            tgz.extractall(path=unpack_dir)
        with open(os.path.join(unpack_dir, TAGS_FILE_NAME)) as tf:
            tags = tf.read().split()
        with open(os.path.join(unpack_dir, JOB_URL_FILE_NAME)) as jf:
            job_url = jf.read()
        for xmlfile in glob.glob(f"{unpack_dir}/*.xml"):
            with tempfile.TemporaryDirectory() as output_dir:
                written_owners = split_junitxml(xmlfile, codeowners, output_dir)
                upload_junitxmls(output_dir, written_owners, tags, job_url)
def junit_upload_from_tgz ( junit_tgz , codeowners_path = ".github/CODEOWNERS" ) : from codeowners import CodeOwners with open ( codeowners_path ) as f : codeowners = CodeOwners ( f . read ( ) ) with tempfile . TemporaryDirectory ( ) as unpack_dir : with tarfile . open ( junit_tgz ) as tgz : tgz . extractall ( path = unpack_dir ) with open ( os . path . join ( unpack_dir , TAGS_FILE_NAME ) ) as tf : tags = tf . read ( ) . split ( ) with open ( os . path . join ( unpack_dir , JOB_URL_FILE_NAME ) ) as jf : job_url = jf . read ( ) for xmlfile in glob . glob ( f"{unpack_dir}/*.xml" ) : with tempfile . TemporaryDirectory ( ) as output_dir : written_owners = split_junitxml ( xmlfile , codeowners , output_dir ) upload_junitxmls ( output_dir , written_owners , tags , job_url )
Upload all JUnit XML files contained in given tgz archive.
Upload all JUnit XML files contained in given tgz archive .
"""
    Upload all JUnit XML files contained in given tgz archive.
    """ # unpack all files from archive # read additional tags # read job url (see comment in produce_junit_tar) # for each unpacked xml file, split it and submit all parts
junit_tgz
codeowners_path