<commit_before>
from contextlib import contextmanager
import os
import subprocess

def _getRepoName():
    repo_name = os.environ.get('CVMFS_TEST_REPO')
    if not repo_name:
        raise RuntimeError("environment variable CVMFS_TEST_REPO not set")
    return repo_name

#
# CVMFS wrappers
#
# Note(rmeusel): This is taken 1-to-1 from the lhcbdev.cern.ch release
#                manager machine. It is meant to be used for a regression
#                test for an issue that arose there in March 2016.
#
#############################################################################

def cvmfsStart(reponame = None):
    """ Start a CVMFS transaction """
    if reponame == None:
        reponame = _getRepoName()

    rc = subprocess.call(["cvmfs_server", "transaction", reponame])
    if rc != 0:
        raise RuntimeError("Could not start CVMFS transaction")

def cvmfsPublish(reponame = None):
    """ Publish a CVMFS transaction """
    if reponame == None:
        reponame = _getRepoName()

    rc = subprocess.call(["cvmfs_server", "publish", reponame])
    if rc != 0:
        raise RuntimeError("Could not publish CVMFS transaction")<commit_msg>TEST: python wrapper uses `cvmfs_server publish -f`<commit_after>
from contextlib import contextmanager
import os
import subprocess

def _getRepoName():
    repo_name = os.environ.get('CVMFS_TEST_REPO')
    if not repo_name:
        raise RuntimeError("environment variable CVMFS_TEST_REPO not set")
    return repo_name

#
# CVMFS wrappers
#
# Note(rmeusel): This is taken 1-to-1 from the lhcbdev.cern.ch release
#                manager machine. It is meant to be used for a regression
#                test for an issue that arose there in March 2016.
#
#############################################################################

def cvmfsStart(reponame = None):
    """ Start a CVMFS transaction """
    if reponame == None:
        reponame = _getRepoName()

    rc = subprocess.call(["cvmfs_server", "transaction", reponame])
    if rc != 0:
        raise RuntimeError("Could not start CVMFS transaction")

def cvmfsPublish(reponame = None):
    """ Publish a CVMFS transaction """
    if reponame == None:
        reponame = _getRepoName()

    rc = subprocess.call(["cvmfs_server", "publish", "-f", reponame])
    if rc != 0:
        raise RuntimeError("Could not publish CVMFS transaction")
{'fraction_non_alphanumeric': 0.15677966101694915, 'fraction_numerical': 0.006779661016949152, 'mean_word_length': 3.488593155893536, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7656083', 'n_tokens_mistral': 726, 'n_tokens_neox': 701, 'n_words': 218}