Add xfail mark to a unit test which trips a Python 3.6 bug.

https://bugs.python.org/issue32404
master
Michael Chisholm 2020-03-17 20:21:09 -04:00
parent f99665f2ba
commit 6f43814918
1 changed files with 10 additions and 1 deletions

View File

@ -1,6 +1,7 @@
import datetime import datetime
import pytest import pytest
import sys
import stix2 import stix2
from stix2.utils import ( from stix2.utils import (
@ -43,11 +44,19 @@ def test_to_enum_errors(value, err_type):
_to_enum(value, Precision) _to_enum(value, Precision)
def test_stix_datetime(): @pytest.mark.xfail(
sys.version_info[:2] == (3, 6), strict=True,
reason="https://bugs.python.org/issue32404",
)
def test_stix_datetime_now():
dt = STIXdatetime.utcnow() dt = STIXdatetime.utcnow()
assert dt.precision is Precision.ANY assert dt.precision is Precision.ANY
assert dt.precision_constraint is PrecisionConstraint.EXACT assert dt.precision_constraint is PrecisionConstraint.EXACT
def test_stix_datetime():
dt = datetime.datetime.utcnow()
sdt = STIXdatetime(dt, precision=Precision.SECOND) sdt = STIXdatetime(dt, precision=Precision.SECOND)
assert sdt.precision is Precision.SECOND assert sdt.precision is Precision.SECOND
assert sdt == dt assert sdt == dt