test fixes

This commit is contained in:
Eugene 2025-05-23 17:02:20 +02:00
parent e91a4cf5d5
commit e13e04ac49
No known key found for this signature in database
GPG key ID: 5896FCBBDD1CF4F4
4 changed files with 24 additions and 10 deletions

16
tests/poetry.lock generated
View file

@ -1333,6 +1333,20 @@ pytest = ">=8.2,<9"
docs = ["sphinx (>=5.3)", "sphinx-rtd-theme (>=1)"]
testing = ["coverage (>=6.2)", "hypothesis (>=5.7.1)"]
[[package]]
name = "pytest-timeout"
version = "2.4.0"
description = "pytest plugin to abort hanging tests"
optional = false
python-versions = ">=3.7"
files = [
{file = "pytest_timeout-2.4.0-py3-none-any.whl", hash = "sha256:c42667e5cdadb151aeb5b26d114aff6bdf5a907f176a007a30b940d3d865b5c2"},
{file = "pytest_timeout-2.4.0.tar.gz", hash = "sha256:7e68e90b01f9eff71332b25001f85c75495fc4e3a836701876183c4bcfd0540a"},
]
[package.dependencies]
pytest = ">=7.0.0"
[[package]]
name = "python-dateutil"
version = "2.9.0.post0"
@ -1661,4 +1675,4 @@ propcache = ">=0.2.1"
[metadata]
lock-version = "2.0"
python-versions = "^3.10"
content-hash = "5a9322c03fb5093281d6bf03b632574c688e041e08a16eaa5ee04885758a274a"
content-hash = "87409e6b5f02be43f66a00ee328b70f4a89d601c5dbcfd513efc4aa89accc229"

View file

@ -24,6 +24,7 @@ black = "^24"
[tool.poetry.group.dev.dependencies]
pytest-asyncio = "^0.26.0"
pytest-timeout = "^2.4.0"
[tool.pytest.ini_options]
minversion = "6.0"

View file

@ -5,5 +5,5 @@ rm target/llvm-cov-target/* || true
cargo llvm-cov clean --workspace
cargo llvm-cov --no-cfg-coverage-nightly --no-report --workspace --all-features -- --skip agent
cd tests
RUST_BACKTRACE=1 ENABLE_COVERAGE=1 poetry run pytest $@
RUST_BACKTRACE=1 ENABLE_COVERAGE=1 poetry run pytest --timeout 60 $@
cargo llvm-cov report --html

View file

@ -33,14 +33,13 @@ class Test:
sdk.RoleDataRequest(name=f"role-{uuid4()}"),
)
user = api.create_user(sdk.CreateUserRequest(username=f"user-{uuid4()}"))
if include_public_key:
api.create_public_key_credential(
user.id,
sdk.NewPublicKeyCredential(
label="Public Key",
openssh_public_key=open("ssh-keys/id_ed25519.pub").read().strip(),
),
)
api.create_public_key_credential(
user.id,
sdk.NewPublicKeyCredential(
label="Public Key",
openssh_public_key=open("ssh-keys/id_ed25519.pub").read().strip(),
),
)
api.create_otp_credential(
user.id,
sdk.NewOtpCredential(