Fix some testing

master
Chris Lenk 2020-04-02 04:46:11 -04:00
parent c911cff97f
commit 897e884217
4 changed files with 6 additions and 10 deletions

View File

@ -1,4 +1,4 @@
sudo: false os: linux
language: python language: python
cache: pip cache: pip
dist: xenial dist: xenial

View File

@ -324,12 +324,9 @@ def _register_observable_extension(
OBJ_MAP_OBSERVABLE = STIX2_OBJ_MAPS[v]['observables'] OBJ_MAP_OBSERVABLE = STIX2_OBJ_MAPS[v]['observables']
EXT_MAP = STIX2_OBJ_MAPS[v]['observable-extensions'] EXT_MAP = STIX2_OBJ_MAPS[v]['observable-extensions']
try:
try: try:
if ext_type in EXT_MAP[observable_type].keys(): if ext_type in EXT_MAP[observable_type].keys():
raise DuplicateRegistrationError("Observable Extension", ext_type) raise DuplicateRegistrationError("Observable Extension", ext_type)
except AttributeError:
pass
EXT_MAP[observable_type][ext_type] = new_extension EXT_MAP[observable_type][ext_type] = new_extension
except KeyError: except KeyError:
if observable_type not in OBJ_MAP_OBSERVABLE: if observable_type not in OBJ_MAP_OBSERVABLE:

View File

@ -1080,8 +1080,7 @@ def test_register_duplicate_observable_with_version():
assert "cannot be registered again" in str(excinfo.value) assert "cannot be registered again" in str(excinfo.value)
@pytest.mark.xfail(reason="The default version is no longer 2.0", condition=stix2.DEFAULT_VERSION != "2.0") def test_register_marking_with_version():
def test_register_marking_with_no_version():
@stix2.v20.CustomMarking( @stix2.v20.CustomMarking(
'x-new-obj-2', [ 'x-new-obj-2', [
('property1', stix2.properties.StringProperty(required=True)), ('property1', stix2.properties.StringProperty(required=True)),

View File

@ -8,11 +8,11 @@ deps =
pytest pytest
pytest-cov pytest-cov
coverage coverage
taxii2-client taxii2-client<1.0.0
fuzzywuzzy fuzzywuzzy
haversine haversine
python-Levenshtein python-Levenshtein
medallion medallion<2.0.0
commands = commands =
python -m pytest --cov=stix2 stix2/test/ --cov-report term-missing -W ignore::stix2.exceptions.STIXDeprecationWarning python -m pytest --cov=stix2 stix2/test/ --cov-report term-missing -W ignore::stix2.exceptions.STIXDeprecationWarning