def __init__( self, version: str, patches: List[str] = [], platform: str = None, architecture: str = None, name: str = None, snapshot: bool = True, build_id: str = None, output_dir: str = "artifacts", ): self.build_id = os.getenv( "BUILD_NUMBER") or build_id or uuid.uuid4().hex self.name = name self.version = version self.patches = patches self.snapshot = snapshot self.architecture = architecture or current_architecture() self.platform = platform or current_platform() self.output_dir = output_dir
def test_subprocess_call(self, mock_subprocess: MagicMock) -> None: current_architecture() mock_subprocess.assert_called_with(["uname", "-m"])
def test_invalid_architecture(self, mock_subprocess: MagicMock) -> None: with self.assertRaises(ValueError) as context: current_architecture() self.assertEqual("Unsupported architecture: invalid", str(context.exception))
def test_arm64_return_arm64_architecture( self, mock_subprocess: MagicMock) -> None: self.assertTrue(current_architecture() == "arm64")
def test_current_architecture(self) -> None: self.assertTrue(current_architecture() in ["x64", "arm64"])
def test_subprocess_call(self, mock_subprocess): current_architecture() subprocess.check_output.assert_called_with(["uname", "-m"])
def test_arm64_return_arm64_architecture(self, mock_subprocess): self.assertTrue(current_architecture() == "arm64")