本文整理汇总了Python中asn1crypto.__version__方法的典型用法代码示例。如果您正苦于以下问题:Python asn1crypto.__version__方法的具体用法?Python asn1crypto.__version__怎么用?Python asn1crypto.__version__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类asn1crypto
的用法示例。
在下文中一共展示了asn1crypto.__version__方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _preload
# 需要导入模块: import asn1crypto [as 别名]
# 或者: from asn1crypto import __version__ [as 别名]
def _preload(require_oscrypto, print_info):
"""
Preloads asn1crypto and optionally oscrypto from a local source checkout,
or from a normal install
:param require_oscrypto:
A bool if oscrypto needs to be preloaded
:param print_info:
A bool if info about asn1crypto and oscrypto should be printed
"""
if print_info:
print('Working dir: ' + getcwd())
print('Python ' + sys.version.replace('\n', ''))
asn1crypto = None
oscrypto = None
if require_oscrypto:
# Some CI services don't use the package name for the dir
if package_name == 'oscrypto':
oscrypto_dir = package_root
else:
oscrypto_dir = os.path.join(build_root, 'oscrypto')
oscrypto_tests = None
if os.path.exists(oscrypto_dir):
oscrypto_tests = _import_from('oscrypto_tests', oscrypto_dir, 'tests')
if oscrypto_tests is None:
import oscrypto_tests
asn1crypto, oscrypto = oscrypto_tests.local_oscrypto()
else:
if package_name == 'asn1crypto':
asn1crypto_dir = package_root
else:
asn1crypto_dir = os.path.join(build_root, 'asn1crypto')
if os.path.exists(asn1crypto_dir):
asn1crypto = _import_from('asn1crypto', asn1crypto_dir)
if asn1crypto is None:
import asn1crypto
if print_info:
print(
'\nasn1crypto: %s, %s' % (
asn1crypto.__version__,
os.path.dirname(asn1crypto.__file__)
)
)
if require_oscrypto:
print(
'oscrypto: %s backend, %s, %s' % (
oscrypto.backend(),
oscrypto.__version__,
os.path.dirname(oscrypto.__file__)
)
)
示例2: test_classes
# 需要导入模块: import asn1crypto [as 别名]
# 或者: from asn1crypto import __version__ [as 别名]
def test_classes():
"""
Returns a list of unittest.TestCase classes for the package
:return:
A list of unittest.TestCase classes
"""
# If we are in a source folder and these tests aren't installed as a
# package, we want to load asn1crypto from this source folder
tests_dir = os.path.dirname(os.path.abspath(__file__))
asn1crypto = None
if os.path.basename(tests_dir) == 'tests':
asn1crypto = _import_from(
'asn1crypto',
os.path.join(tests_dir, '..')
)
if asn1crypto is None:
import asn1crypto
if asn1crypto.__version__ != __version__:
raise AssertionError(
('asn1crypto_tests version %s can not be run with ' % __version__) +
('asn1crypto version %s' % asn1crypto.__version__)
)
from .test_algos import AlgoTests
from .test_cms import CMSTests
from .test_crl import CRLTests
from .test_csr import CSRTests
from .test_init import InitTests
from .test_keys import KeysTests
from .test_ocsp import OCSPTests
from .test_pem import PEMTests
from .test_pkcs12 import PKCS12Tests
from .test_tsp import TSPTests
from .test_x509 import X509Tests
from .test_util import UtilTests
from .test_parser import ParserTests
from .test_core import CoreTests
return [
AlgoTests,
CMSTests,
CRLTests,
CSRTests,
InitTests,
KeysTests,
OCSPTests,
PEMTests,
PKCS12Tests,
TSPTests,
UtilTests,
ParserTests,
X509Tests,
CoreTests
]