<commit_before>from pnc_cli import buildconfigurations
from pnc_cli import buildconfigurationsets
from pnc_cli import makemead
from pnc_cli import projects
import random
import string

def test_eap():
    # EAP 7.1.0.Alpha
    sufix = get_sufix()
    set_name = "jb-eap-7.1-rhel-7-candidate" + sufix
    set = buildconfigurationsets.create_build_configuration_set(name=set_name)
    project = projects.get_project(name="eap7")
    eap_name = "org.jboss.eap-jboss-eap-parent-7.1.0.Alpha1-redhat-8" + sufix
    build_config = buildconfigurations.create_build_configuration(
                                                                  name=eap_name,
                                                                  project=project.id,
                                                                  environment=1,
                                                                  scm_repo_url="git+ssh://<EMAIL>:29418/pnc/org.jboss.eap-jboss-eap-parent-7.1.0.Alpha1-redhat-8.git",
                                                                  scm_revision="branch-EAP_7.1.0.DR7",
                                                                  build_script="mvn clean deploy -DskipTests=true -Prelease")

    buildconfigurationsets.add_build_configuration_to_set(set_id=set.id, config_id=build_config.id)
    build_record = buildconfigurationsets.build_set(id=set.id)
    assert build_record is not None
    print set.id

def test_sso():
    makemead.make_mead(config="cfg/sso.cfg", artifact=None)

def test_jdg():
    makemead.make_mead(config="cfg/jdg.cfg", artifact=None)

def get_sufix():
    return "-" + ''.join(random.choice(string.ascii_uppercase + string.digits)
                         for _ in range(10))<commit_msg>Creating a project if not existing<commit_after>from pnc_cli import buildconfigurations
from pnc_cli import buildconfigurationsets
from pnc_cli import makemead
from pnc_cli import projects
import logging
import random
import string

def test_eap():
    # EAP 7.1.0.Alpha
    project_name = "eap7"
    sufix = get_sufix()
    set_name = "jb-eap-7.1-rhel-7-candidate" + sufix
    set = buildconfigurationsets.create_build_configuration_set(name=set_name)
    try:
        project = projects.get_project(name=project_name)
    except ValueError:
        logging.error('No project ' + project_name)
        project = projects.create_project(name=project_name)
    eap_name = "org.jboss.eap-jboss-eap-parent-7.1.0.Alpha1-redhat-8" + sufix
    build_config = buildconfigurations.create_build_configuration(
                                                                  name=eap_name,
                                                                  project=project.id,
                                                                  environment=1,
                                                                  scm_repo_url="git+ssh://user-pnc-gerrit@pnc-gerrit.<EMAIL>.com:29418/pnc/org.jboss.eap-jboss-eap-parent-7.1.0.Alpha1-redhat-8.git",
                                                                  scm_revision="branch-EAP_7.1.0.DR7",
                                                                  build_script="mvn clean deploy -DskipTests=true -Prelease")

    buildconfigurationsets.add_build_configuration_to_set(set_id=set.id, config_id=build_config.id)
    build_record = buildconfigurationsets.build_set(id=set.id)
    assert build_record is not None
    print set.id

def test_sso():
    makemead.make_mead(config="cfg/sso.cfg", cproject=True)

def test_jdg():
    makemead.make_mead(config="cfg/jdg.cfg", cproject=True)

def get_sufix():
    return "-" + ''.join(random.choice(string.ascii_uppercase + string.digits)
                         for _ in range(10))
{'fraction_non_alphanumeric': 0.0917381974248927, 'fraction_numerical': 0.01555793991416309, 'mean_word_length': 1.8100979653353428, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4866689', 'n_tokens_mistral': 1105, 'n_tokens_neox': 1076, 'n_words': 166}