diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f3796251..046c1488 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,14 +25,14 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install required dpkg packages run: sudo apt-get install libxslt1-dev bzr subversion mercurial - name: Generate default locales run: | - sudo locale-gen "en_US.UTF-8" + sudo apt-get update && sudo apt-get install tzdata locales -y && sudo locale-gen "en_US.UTF-8" sudo dpkg-reconfigure locales sudo update-locale "LANG=en_US.UTF-8" sudo update-locale "LC_ALL=en_US.UTF-8" diff --git a/tests/gitfixtures.py b/tests/gitfixtures.py index 11136a54..27604ac9 100644 --- a/tests/gitfixtures.py +++ b/tests/gitfixtures.py @@ -16,6 +16,14 @@ class GitFixtures(Fixtures): def init(self): self.user_name = 'test' self.user_email = 'test@test.com' + + tmpdir = os.path.join(os.path.dirname( + os.path.abspath(__file__)), 'tmp') + gitconfig = os.path.join(tmpdir, '.gitconfig') + os.environ["GIT_CONFIG_GLOBAL"] = gitconfig + self.safe_run('config --global protocol.file.allow always') + self.safe_run('config --global commit.gpgsign false') + self.create_repo(self.repo_path) self.wdir = self.repo_path self.submodules_path = self.container_dir + '/submodules' @@ -40,7 +48,6 @@ def create_repo(self, repo_path): self.safe_run('init') self.safe_run('config user.name ' + self.user_name) self.safe_run('config user.email ' + self.user_email) - self.safe_run('config commit.gpgsign false') print("created repo %s" % repo_path) def get_metadata(self, fmt): diff --git a/tests/utils.py b/tests/utils.py index 4b216917..856163e0 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -8,6 +8,7 @@ import io import shutil import subprocess +import sys import six @@ -22,12 +23,32 @@ def mkfreshdir(path): os.makedirs(path) os.chdir(cwd) +def check_locale(loc): + try: + aloc_tmp = subprocess.check_output(['locale', '-a']) + except AttributeError: + aloc_tmp, _ = subprocess.Popen(['locale', '-a'], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT).communicate() + aloc = {} + + for tloc in aloc_tmp.split(b'\n'): + aloc[tloc] = 1 + + for tloc in loc: + print("Checking .... %s"%tloc, file=sys.stderr) + try: + if aloc[tloc.encode()]: + return tloc + except KeyError: + pass + + return 'C' def run_cmd(cmd): - os.putenv('LANG', 'C.utf-8') - os.putenv('LC_ALL', 'C.utf-8') - os.environ['LANG'] = 'C.utf-8' - os.environ['LC_ALL'] = 'C.utf-8' + use_locale = check_locale(["en_US.utf8", 'C.utf8']) + os.environ['LANG'] = use_locale + os.environ['LC_ALL'] = use_locale if six.PY3: cmd = cmd.encode('UTF-8') proc = subprocess.Popen(