# Path: qa/shell.py
# def git(*command_parts, **kwargs):
#     return run_command("git", *command_parts, **kwargs)
# 
# def gitlint(*command_parts, **kwargs):
#     return run_command("gitlint", *command_parts, **kwargs)
# 
# class RunningCommand:
#     pass
# 
# Path: qa/utils.py
# DEFAULT_ENCODING = getpreferredencoding()


import io
import os
import platform
import shutil
import sys
import tempfile
import arrow
from datetime import datetime
from uuid import uuid4
from unittest import TestCase
from qa.shell import git, gitlint, RunningCommand
from qa.utils import DEFAULT_ENCODING
        # pylint: disable=consider-using-with
        io.open(os.path.join(parent_dir, test_filename), 'a', encoding=DEFAULT_ENCODING).close()
        return test_filename

    @staticmethod
    def create_environment(envvars=None):
        """ Creates a copy of the current os.environ and adds/overwrites a given set of variables to it """
        environment = os.environ.copy()
        if envvars:
            environment.update(envvars)
        return environment

    def create_tmp_git_config(self, contents):
        """ Creates an environment with the GIT_CONFIG variable set to a file with the given contents. """
        tmp_config = self.create_tmpfile(contents)
        return self.create_environment({"GIT_CONFIG": tmp_config})

    def create_simple_commit(self, message, out=None, ok_code=None, env=None, git_repo=None, tty_in=False):
        """ Creates a simple commit with an empty test file.
            :param message: Commit message for the commit. """

        git_repo = self.tmp_git_repo if git_repo is None else git_repo

        # Let's make sure that we copy the environment in which this python code was executed as environment
        # variables can influence how git runs.
        # This was needed to fix https://github.com/jorisroovers/gitlint/issues/15 as we need to make sure to use
        # the PATH variable that contains the virtualenv's python binary.
        environment = self.create_environment(env)

        # Create file and add to git

# Path: qa/shell.py
# def git(*command_parts, **kwargs):
#     return run_command("git", *command_parts, **kwargs)
# 
# def gitlint(*command_parts, **kwargs):
#     return run_command("gitlint", *command_parts, **kwargs)
# 
# class RunningCommand:
#     pass
# 
# Path: qa/utils.py
# DEFAULT_ENCODING = getpreferredencoding()


# Path: qa/base.py
import io
import os
import platform
import shutil
import sys
import tempfile
import arrow
from datetime import datetime
from uuid import uuid4
from unittest import TestCase
from qa.shell import git, gitlint, RunningCommand
from qa.utils import DEFAULT_ENCODING

        # pylint: disable=consider-using-with
        io.open(os.path.join(parent_dir, test_filename), 'a', encoding=DEFAULT_ENCODING).close()
        return test_filename

    @staticmethod
    def create_environment(envvars=None):
        """ Creates a copy of the current os.environ and adds/overwrites a given set of variables to it """
        environment = os.environ.copy()
        if envvars:
            environment.update(envvars)
        return environment

    def create_tmp_git_config(self, contents):
        """ Creates an environment with the GIT_CONFIG variable set to a file with the given contents. """
        tmp_config = self.create_tmpfile(contents)
        return self.create_environment({"GIT_CONFIG": tmp_config})

    def create_simple_commit(self, message, out=None, ok_code=None, env=None, git_repo=None, tty_in=False):
        """ Creates a simple commit with an empty test file.
            :param message: Commit message for the commit. """

        git_repo = self.tmp_git_repo if git_repo is None else git_repo

        # Let's make sure that we copy the environment in which this python code was executed as environment
        # variables can influence how git runs.
        # This was needed to fix https://github.com/jorisroovers/gitlint/issues/15 as we need to make sure to use
        # the PATH variable that contains the virtualenv's python binary.
        environment = self.create_environment(env)

        # Create file and add to git

        test_filename = self.create_file(git_repo)