# 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
        return os.path.join(samples_dir, filename)

    def get_last_commit_short_hash(self, git_repo=None):
        git_repo = self.tmp_git_repo if git_repo is None else git_repo
        return git("rev-parse", "--short", "HEAD", _cwd=git_repo, _err_to_out=True).replace("\n", "")

    def get_last_commit_hash(self, git_repo=None):
        git_repo = self.tmp_git_repo if git_repo is None else git_repo
        return git("rev-parse", "HEAD", _cwd=git_repo, _err_to_out=True).replace("\n", "")

    @staticmethod
    def get_expected(filename="", variable_dict=None):
        """ Utility method to read an 'expected' file and return it as a string. Optionally replace template variables
        specified by variable_dict. """
        expected_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "expected")
        expected_path = os.path.join(expected_dir, filename)
        with io.open(expected_path, encoding=DEFAULT_ENCODING) as file:
            expected = file.read()

            if variable_dict:
                expected = expected.format(**variable_dict)
            return expected

    @staticmethod
    def get_system_info_dict():
        """ Returns a dict with items related to system values logged by `gitlint --debug` """
        expected_gitlint_version = gitlint("--version").replace("gitlint, version ", "").strip()
        expected_git_version = git("--version").strip()
        return {'platform': platform.platform(), 'python_version': sys.version,
                'git_version': expected_git_version, 'gitlint_version': expected_gitlint_version,

# 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

        return os.path.join(samples_dir, filename)

    def get_last_commit_short_hash(self, git_repo=None):
        git_repo = self.tmp_git_repo if git_repo is None else git_repo
        return git("rev-parse", "--short", "HEAD", _cwd=git_repo, _err_to_out=True).replace("\n", "")

    def get_last_commit_hash(self, git_repo=None):
        git_repo = self.tmp_git_repo if git_repo is None else git_repo
        return git("rev-parse", "HEAD", _cwd=git_repo, _err_to_out=True).replace("\n", "")

    @staticmethod
    def get_expected(filename="", variable_dict=None):
        """ Utility method to read an 'expected' file and return it as a string. Optionally replace template variables
        specified by variable_dict. """
        expected_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "expected")
        expected_path = os.path.join(expected_dir, filename)
        with io.open(expected_path, encoding=DEFAULT_ENCODING) as file:
            expected = file.read()

            if variable_dict:
                expected = expected.format(**variable_dict)
            return expected

    @staticmethod
    def get_system_info_dict():
        """ Returns a dict with items related to system values logged by `gitlint --debug` """
        expected_gitlint_version = gitlint("--version").replace("gitlint, version ", "").strip()
        expected_git_version = git("--version").strip()
        return {'platform': platform.platform(), 'python_version': sys.version,
                'git_version': expected_git_version, 'gitlint_version': expected_gitlint_version,

                'GITLINT_USE_SH_LIB': BaseTestCase.GITLINT_USE_SH_LIB, 'DEFAULT_ENCODING': DEFAULT_ENCODING}