improve setup command by --makeflags-jobs argument and fix repository sign on creation

This commit is contained in:
2022-11-29 16:06:41 +02:00
parent 0161617e36
commit 01eda513cf
8 changed files with 54 additions and 26 deletions

View File

@ -1,11 +1,13 @@
import datetime
import logging
import os
import pytest
import requests
import subprocess
from pathlib import Path
from pytest_mock import MockerFixture
from typing import Any
from unittest.mock import MagicMock
from ahriman.core.exceptions import BuildError, OptionError, UnsafeRunError
@ -75,6 +77,19 @@ def test_check_output_multiple_with_stdin_newline() -> None:
input_data="multiple\nlines\n") == "multiple\nlines"
def test_check_output_with_user(passwd: Any, mocker: MockerFixture) -> None:
"""
must run command as specified user and set its homedir
"""
assert check_output("python", "-c", "import os; print(os.getenv('HOME'))") != passwd.pw_dir
getpwuid_mock = mocker.patch("ahriman.core.util.getpwuid", return_value=passwd)
user = os.getuid()
assert check_output("python", "-c", "import os; print(os.getenv('HOME'))", user=user) == passwd.pw_dir
getpwuid_mock.assert_called_once_with(user)
def test_check_output_failure(mocker: MockerFixture) -> None:
"""
must process exception correctly