<commit_before># -*- coding: utf-8 -*-
"""
This file is part of pyCMBS. (c) 2012-2014
For COPYING and LICENSE details, please refer to the file
COPYRIGHT.md
"""

import unittest
import os
import pycmbs.benchmarking.utils as utils


class TestUtils(unittest.TestCase):

    def setUp(self):
        # setup environment variables
        os.environ['SEP'] = os.getcwd() + os.sep + 'SEP'
        os.environ['CDOTEMPDIR'] = os.getcwd() + os.sep + 'CDOTEMPDIR'
        if not os.path.exists(os.environ['SEP']):
            os.makedirs(os.environ['SEP'])
        if not os.path.exists(os.environ['CDOTEMPDIR']):
            os.makedirs(os.environ['CDOTEMPDIR'])

    def tearDown(self):
        # remove temporary dirs
        if os.path.exists(os.getcwd() + os.sep + 'SEP'):
            cmd = 'rm -rf ' + os.getcwd() + os.sep + 'SEP'
            os.system(cmd)
        if os.path.exists(os.getcwd() + os.sep + 'CDOTEMPDIR'):
            cmd = 'rm -rf ' + os.getcwd() + os.sep + 'CDOTEMPDIR'
            os.system(cmd)

    def test_get_data_pool_OK(self):
        os.environ['SEP'] = os.getcwd()
        p = utils.get_data_pool_directory()
        self.assertEqual(p, os.getcwd())

    def test_PoolDirectory_SetToCwd(self):
        os.environ.pop('SEP') 
        local_dir = os.getcwd()
        pool_dir = utils.get_data_pool_directory()
        self.assertEqual(pool_dir, local_dir)

    @unittest.skip('skipping as it\'s hard to emulate a non existing root path')
    def test_get_data_pool_Default(self):
        if 'SEP' in os.environ.keys():
            xx = os.environ.pop('SEP')
        p = utils.get_data_pool_directory()
        self.assertEqual(p, '/pool/SEP/')<commit_msg>[tests/utils] fixed test for default pool dir<commit_after># -*- coding: utf-8 -*-
"""
This file is part of pyCMBS. (c) 2012-2014
For COPYING and LICENSE details, please refer to the file
COPYRIGHT.md
"""

import unittest
import os
import pycmbs.benchmarking.utils as utils


class TestUtils(unittest.TestCase):

    def setUp(self):
        # setup environment variables
        os.environ['SEP'] = os.getcwd() + os.sep + 'SEP'
        os.environ['CDOTEMPDIR'] = os.getcwd() + os.sep + 'CDOTEMPDIR'
        if not os.path.exists(os.environ['SEP']):
            os.makedirs(os.environ['SEP'])
        if not os.path.exists(os.environ['CDOTEMPDIR']):
            os.makedirs(os.environ['CDOTEMPDIR'])

    def tearDown(self):
        # remove temporary dirs
        if os.path.exists(os.getcwd() + os.sep + 'SEP'):
            cmd = 'rm -rf ' + os.getcwd() + os.sep + 'SEP'
            os.system(cmd)
        if os.path.exists(os.getcwd() + os.sep + 'CDOTEMPDIR'):
            cmd = 'rm -rf ' + os.getcwd() + os.sep + 'CDOTEMPDIR'
            os.system(cmd)

    def test_get_data_pool_OK(self):
        os.environ['SEP'] = os.getcwd()
        p = utils.get_data_pool_directory()
        self.assertEqual(p, os.getcwd())

    def test_PoolDirectory_SetToCwd(self):
        os.environ.pop('SEP') 
        local_dir = os.getcwd() + os.sep
        pool_dir = utils.get_data_pool_directory()
        self.assertEqual(pool_dir, local_dir)

    @unittest.skip('skipping as it\'s hard to emulate a non existing root path')
    def test_get_data_pool_Default(self):
        if 'SEP' in os.environ.keys():
            xx = os.environ.pop('SEP')
        p = utils.get_data_pool_directory()
        self.assertEqual(p, '/pool/SEP/')
{'fraction_non_alphanumeric': 0.14386584289496912, 'fraction_numerical': 0.00529567519858782, 'mean_word_length': 2.530633437175493, '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': '1199894', 'n_tokens_mistral': 1209, 'n_tokens_neox': 1211, 'n_words': 246}