HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/Users/fred/anaconda3/pkgs/pyjwt-2.8.0-py312haa95532_0/info/test/tests/utils.py
import os
from calendar import timegm
from datetime import datetime, timezone

import pytest

from jwt.algorithms import has_crypto


def utc_timestamp():
    return timegm(datetime.now(tz=timezone.utc).utctimetuple())


def key_path(key_name):
    return os.path.join(os.path.dirname(os.path.realpath(__file__)), "keys", key_name)


def no_crypto_required(class_or_func):
    decorator = pytest.mark.skipif(
        has_crypto,
        reason="Requires cryptography library not installed",
    )
    return decorator(class_or_func)


def crypto_required(class_or_func):
    decorator = pytest.mark.skipif(
        not has_crypto, reason="Requires cryptography library installed"
    )
    return decorator(class_or_func)