mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-17 21:40:13 +00:00
* ci: drop dlltool from nodejs libs release * nodejs: download libsimplex into the user cache * nodejs: load libsimplex at runtime per backend * support bot: select db backend with --db * python: match backend switch error text * nodejs: download prebuilt add-on at runtime * ci: build nodejs add-on for libs release * calculator bot: load libs and add-on in image * support bot: document add-on override * nodejs: keep worker test output free of colors * nodejs: verify sha-256 of downloaded assets * python: pin core libs release with sha-256 * ci: add packages release script * ci: release nodejs add-on and open release PR * ci: publish packages after release PR * nodejs: keep npm from building the add-on * calculator bot: build the add-on in the image * ci: merge package release workflows * ci: open release PR when publishing fails * ci: build the add-on with node-addon-api only * ci: skip publishing in a called packages workflow * ci: update package release actions to Node 24 * nodejs: fix receive test timeout * ci: test packages on pull requests * nodejs: reuse the database in the close stress test * ci: keep failed package tests from hanging * ci: skip preset server tests * ci: plan package builds from the changes * ci: test packages with a given libsimplex * ci: test packages with libsimplex of core changes
59 lines
1.7 KiB
Python
59 lines
1.7 KiB
Python
from unittest.mock import patch
|
|
|
|
import pytest
|
|
|
|
from simplex_chat._native import _libname, _libs_url, _platform_tag
|
|
from simplex_chat._version import LIBS_RELEASE
|
|
|
|
|
|
@patch("sys.platform", "linux")
|
|
@patch("platform.machine", return_value="x86_64")
|
|
def test_platform_linux_x64(_):
|
|
assert _platform_tag() == "linux-x86_64"
|
|
|
|
|
|
@patch("sys.platform", "darwin")
|
|
@patch("platform.machine", return_value="arm64")
|
|
def test_platform_macos_arm64(_):
|
|
assert _platform_tag() == "macos-aarch64"
|
|
|
|
|
|
@patch("sys.platform", "win32")
|
|
@patch("platform.machine", return_value="AMD64")
|
|
def test_platform_windows_x64(_):
|
|
assert _platform_tag() == "windows-x86_64"
|
|
|
|
|
|
@patch("sys.platform", "freebsd")
|
|
@patch("platform.machine", return_value="x86_64")
|
|
def test_platform_unsupported(_):
|
|
with pytest.raises(RuntimeError, match="Unsupported"):
|
|
_platform_tag()
|
|
|
|
|
|
def test_libname_per_platform():
|
|
with patch("sys.platform", "linux"):
|
|
assert _libname() == "libsimplex.so"
|
|
with patch("sys.platform", "darwin"):
|
|
assert _libname() == "libsimplex.dylib"
|
|
with patch("sys.platform", "win32"):
|
|
assert _libname() == "libsimplex.dll"
|
|
|
|
|
|
@patch("simplex_chat._native._platform_tag", return_value="linux-x86_64")
|
|
def test_url_sqlite(_):
|
|
assert (
|
|
_libs_url("sqlite")
|
|
== "https://github.com/simplex-chat/simplex-chat-libs/releases/download/"
|
|
f"{LIBS_RELEASE}/simplex-chat-libs-linux-x86_64.zip"
|
|
)
|
|
|
|
|
|
@patch("simplex_chat._native._platform_tag", return_value="linux-x86_64")
|
|
def test_url_postgres(_):
|
|
assert (
|
|
_libs_url("postgres")
|
|
== "https://github.com/simplex-chat/simplex-chat-libs/releases/download/"
|
|
f"{LIBS_RELEASE}/simplex-chat-libs-linux-x86_64-postgres.zip"
|
|
)
|