Backport module for sys.audit and sys.addaudithook mechanism
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

31 lines
671 B

import unittest
import pytest
import sysaudit
def hook(event, args):
pass
@pytest.mark.benchmark(group="audit")
def test_csysaudit_audit(benchmark):
sysaudit.csysaudit_addaudithook(hook)
benchmark(sysaudit.csysaudit_audit, "event", 1, 2, 3)
@pytest.mark.benchmark(group="audit")
def test_std_audit(benchmark):
if not sysaudit.std_audit:
raise unittest.SkipTest("stdlib version not available")
sysaudit.std_addaudithook(hook)
benchmark(sysaudit.std_audit, "event", 1, 2, 3)
@pytest.mark.benchmark(group="audit")
def test_py_audit(benchmark):
sysaudit.py_addaudithook(hook)
benchmark(sysaudit.py_audit, "event", 1, 2, 3)