mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
Merge branch 'skip-crypto-test-if-memlock-too-low' of https://github.com/ogayot/kitty
This commit is contained in:
@@ -3,12 +3,27 @@
|
|||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import unittest
|
||||||
|
|
||||||
from . import BaseTest
|
from . import BaseTest
|
||||||
|
|
||||||
|
|
||||||
|
def is_rlimit_memlock_too_low() -> bool:
|
||||||
|
''' On supported systems, return true if the MEMLOCK limit is too low to
|
||||||
|
run the crypto test. '''
|
||||||
|
try:
|
||||||
|
import resource
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
memlock_limit, _ = resource.getrlimit(resource.RLIMIT_MEMLOCK)
|
||||||
|
pagesize = resource.getpagesize()
|
||||||
|
return memlock_limit <= pagesize
|
||||||
|
|
||||||
|
|
||||||
class TestCrypto(BaseTest):
|
class TestCrypto(BaseTest):
|
||||||
|
|
||||||
|
@unittest.skipIf(is_rlimit_memlock_too_low(), 'RLIMIT_MEMLOCK is too low')
|
||||||
def test_elliptic_curve_data_exchange(self):
|
def test_elliptic_curve_data_exchange(self):
|
||||||
from kitty.fast_data_types import AES256GCMDecrypt, AES256GCMEncrypt, CryptoError, EllipticCurveKey
|
from kitty.fast_data_types import AES256GCMDecrypt, AES256GCMEncrypt, CryptoError, EllipticCurveKey
|
||||||
alice = EllipticCurveKey()
|
alice = EllipticCurveKey()
|
||||||
|
|||||||
Reference in New Issue
Block a user