<commit_before>#!/usr/bin/env python

# standard library modules, , ,
import unittest
import os
import subprocess

# vcs, , represent version controlled directories, internal
from yotta.lib import vcs
# fsutils, , misc filesystem utils, internal
from yotta.lib import fsutils


Test_Repo = "<EMAIL>:autopulated/testing-dummy.git"

class TestGit(unittest.TestCase):
    def setUp(self):
        # test if we have a git user set up, if not we need to set one
        child = subprocess.Popen([
                'git','config', '--global', 'user.email'
            ], stdout=subprocess.PIPE, stderr=subprocess.PIPE
        )
        out, err = child.communicate()
        if not len(out):
            child = subprocess.Popen([
                    'git','config', '--global', 'user.email', '<EMAIL>'
                ], stdout=subprocess.PIPE, stderr=subprocess.PIPE
            )
            out, err = child.communicate()
        self.working_copy = vcs.Git.cloneToTemporaryDir(Test_Repo)
        self.assertTrue(self.working_copy)
        
    def tearDown(self):
        self.working_copy.remove()

    def test_isClean(self):
        self.assertTrue(self.working_copy.isClean())
        fsutils.rmF(os.path.join(self.working_copy.workingDirectory(), 'package.json'))
        self.assertFalse(self.working_copy.isClean())
    
    def test_commit(self):
        with open(os.path.join(self.working_copy.workingDirectory(), 'package.json'), "a") as f:
            f.write("\n")
        self.working_copy.markForCommit('package.json')
        self.working_copy.commit('test commit: DO NOT PUSH')
        self.assertTrue(self.working_copy.isClean())

if __name__ == '__main__':<commit_msg>try to fix git config in Travis again<commit_after>#!/usr/bin/env python

# standard library modules, , ,
import unittest
import os
import subprocess

# vcs, , represent version controlled directories, internal
from yotta.lib import vcs
# fsutils, , misc filesystem utils, internal
from yotta.lib import fsutils


Test_Repo = "<EMAIL>:autopulated/testing-dummy.git"

class TestGit(unittest.TestCase):
    def setUp(self):
        # test if we have a git user set up, if not we need to set one
        child = subprocess.Popen([
                'git','config', '--global', 'user.email'
            ], stdout=subprocess.PIPE, stderr=subprocess.PIPE
        )
        out, err = child.communicate()
        if not len(out):
            commands = [
                ['git','config', '--global', 'user.email', '<EMAIL>'],
                ['git','config', '--global', 'user.name', '<NAME>']
            ]
            for cmd in commands:
                child = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            out, err = child.communicate()
        self.working_copy = vcs.Git.cloneToTemporaryDir(Test_Repo)
        self.assertTrue(self.working_copy)
        
    def tearDown(self):
        self.working_copy.remove()

    def test_isClean(self):
        self.assertTrue(self.working_copy.isClean())
        fsutils.rmF(os.path.join(self.working_copy.workingDirectory(), 'package.json'))
        self.assertFalse(self.working_copy.isClean())
    
    def test_commit(self):
        with open(os.path.join(self.working_copy.workingDirectory(), 'package.json'), "a") as f:
            f.write("\n")
        self.working_copy.markForCommit('package.json')
        self.working_copy.commit('test commit: DO NOT PUSH')
        self.assertTrue(self.working_copy.isClean())

if __name__ == '__main__':
{'fraction_non_alphanumeric': 0.12827822120866592, 'fraction_numerical': 0.0, 'mean_word_length': 2.7053854276663145, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '2036654', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1062, 'n_words': 229}