mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
Skip api tests on Python < 3.6
The new metadata module uses constructs that are only available on Python >= 3.6 (typing, f-format strings, etc.). Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
This commit is contained in:
parent
17f08ad200
commit
b1dd3d6787
1 changed files with 18 additions and 4 deletions
|
|
@ -3,7 +3,10 @@
|
|||
# Copyright 2020, New York University and the TUF contributors
|
||||
# SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
""" Unit tests for api/metdata.py
|
||||
|
||||
"""
|
||||
|
||||
import sys
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
|
|
@ -13,10 +16,21 @@
|
|||
from datetime import timedelta
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from tuf.api.metadata import (
|
||||
Snapshot,
|
||||
Timestamp,
|
||||
)
|
||||
# TODO: Remove case handling when fully dropping support for versions >= 3.6
|
||||
IS_PY_VERSION_SUPPORTED = sys.version_info >= (3, 6)
|
||||
|
||||
# Use setUpModule to tell unittest runner to skip this test module gracefully.
|
||||
def setUpModule():
|
||||
if not IS_PY_VERSION_SUPPORTED:
|
||||
raise unittest.SkipTest("requires Python 3.6 or higher")
|
||||
|
||||
# Since setUpModule is called after imports we need to import conditionally.
|
||||
if IS_PY_VERSION_SUPPORTED:
|
||||
from tuf.api.metadata import (
|
||||
Snapshot,
|
||||
Timestamp,
|
||||
)
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue