# 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
        self.tmpfiles = []
        self.tmp_git_repos = []
        self.tmp_git_repo = self.create_tmp_git_repo()

    def tearDown(self):
        # Clean up temporary files and repos
        for tmpfile in self.tmpfiles:
            os.remove(tmpfile)
        for repo in self.tmp_git_repos:
            shutil.rmtree(repo)

    def assertEqualStdout(self, output, expected):  # pylint: disable=invalid-name
        self.assertIsInstance(output, RunningCommand)
        output = output.stdout.decode(DEFAULT_ENCODING)
        output = output.replace('\r', '')
        self.assertMultiLineEqual(output, expected)

    @staticmethod
    def generate_temp_path():
        timestamp = datetime.now().strftime("%Y%m%d-%H%M%S-%f")
        return os.path.realpath(f"/tmp/gitlint-test-{timestamp}")

    def create_tmp_git_repo(self):
        """ Creates a temporary git repository and returns its directory path """
        tmp_git_repo = self.generate_temp_path()
        self.tmp_git_repos.append(tmp_git_repo)

        git("init", tmp_git_repo)
        # configuring name and email is required in every git repot
        git("config", "user.name", "gitlint-test-user", _cwd=tmp_git_repo)

# 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

        self.tmpfiles = []
        self.tmp_git_repos = []
        self.tmp_git_repo = self.create_tmp_git_repo()

    def tearDown(self):
        # Clean up temporary files and repos
        for tmpfile in self.tmpfiles:
            os.remove(tmpfile)
        for repo in self.tmp_git_repos:
            shutil.rmtree(repo)

    def assertEqualStdout(self, output, expected):  # pylint: disable=invalid-name
        self.assertIsInstance(output, RunningCommand)
        output = output.stdout.decode(DEFAULT_ENCODING)
        output = output.replace('\r', '')
        self.assertMultiLineEqual(output, expected)

    @staticmethod
    def generate_temp_path():
        timestamp = datetime.now().strftime("%Y%m%d-%H%M%S-%f")
        return os.path.realpath(f"/tmp/gitlint-test-{timestamp}")

    def create_tmp_git_repo(self):
        """ Creates a temporary git repository and returns its directory path """
        tmp_git_repo = self.generate_temp_path()
        self.tmp_git_repos.append(tmp_git_repo)

        git("init", tmp_git_repo)
        # configuring name and email is required in every git repot
        git("config", "user.name", "gitlint-test-user", _cwd=tmp_git_repo)

        git("config", "user.email", "gitlint@test.com", _cwd=tmp_git_repo)