From f321447ecccd12528fe4e6d4679f0b0296c42fc0 Mon Sep 17 00:00:00 2001 From: clenk Date: Thu, 1 Jun 2017 16:47:56 -0400 Subject: [PATCH 1/3] Make Travis happy with cosmetic fixes --- stix2/base.py | 9 ++++++--- stix2/sources/taxii.py | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/stix2/base.py b/stix2/base.py index 7d2bf24..cde8bb6 100644 --- a/stix2/base.py +++ b/stix2/base.py @@ -5,9 +5,12 @@ import copy import datetime as dt import json -from .exceptions import (AtLeastOnePropertyError, DependentPropertiesError, ExtraPropertiesError, ImmutableError, - InvalidObjRefError, InvalidValueError, MissingPropertiesError, MutuallyExclusivePropertiesError, - RevokeError, UnmodifiablePropertyError) +from .exceptions import (AtLeastOnePropertyError, DependentPropertiesError, + ExtraPropertiesError, ImmutableError, + InvalidObjRefError, InvalidValueError, + MissingPropertiesError, + MutuallyExclusivePropertiesError, RevokeError, + UnmodifiablePropertyError) from .utils import NOW, format_datetime, get_timestamp, parse_into_datetime __all__ = ['STIXJSONEncoder', '_STIXBase'] diff --git a/stix2/sources/taxii.py b/stix2/sources/taxii.py index 09c1b9d..c83d220 100644 --- a/stix2/sources/taxii.py +++ b/stix2/sources/taxii.py @@ -206,7 +206,7 @@ class TAXIIDataSource(DataSource): all_data.append(stix_obj) except requests.exceptions.RequestException as e: - raise + raise e # raise type(e), type(e)(e.message + # "Attempting to connect to %s" % coll_url) From 61c1e074330ec7a7781bfbd69429fffb924f6eb6 Mon Sep 17 00:00:00 2001 From: clenk Date: Thu, 1 Jun 2017 17:00:22 -0400 Subject: [PATCH 2/3] Move codecov invocation from Tox to Travis This avoids errors when running Tox locally. Also display line numbers missing test coverage. --- .travis.yml | 3 +++ setup.py | 1 + tox.ini | 4 +--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1937814..fdbb686 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,9 @@ python: install: - pip install -U pip setuptools - pip install tox-travis pre-commit + - pip install codecov script: - tox - if [[ $TRAVIS_PYTHON_VERSION != 2.6 ]]; then pre-commit run --all-files; fi +after_success: + - codecov diff --git a/setup.py b/setup.py index 15394b1..ff5ac0b 100644 --- a/setup.py +++ b/setup.py @@ -5,6 +5,7 @@ install_requires = [ 'pytz', 'six', 'python-dateutil', + 'requests', ] setup( diff --git a/tox.ini b/tox.ini index ff386d6..f52a858 100644 --- a/tox.ini +++ b/tox.ini @@ -8,10 +8,8 @@ deps = pytest pytest-cov coverage - codecov commands = - py.test --cov=stix2 stix2/test/ - codecov + py.test --cov=stix2 stix2/test/ --cov-report term-missing passenv = CI TRAVIS TRAVIS_* From 229ab5d323a412ee91e8462701c816e1dfc0d521 Mon Sep 17 00:00:00 2001 From: clenk Date: Thu, 1 Jun 2017 17:17:03 -0400 Subject: [PATCH 3/3] Fix import order --- .isort.cfg | 2 +- examples/taxii_example.py | 1 + tox.ini | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.isort.cfg b/.isort.cfg index 56f50d1..63f5b73 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -1,7 +1,7 @@ [settings] check=1 diff=1 -known_third_party=dateutil,pytest,pytz,six +known_third_party=dateutil,pytest,pytz,six,requests known_first_party=stix2 not_skip=__init__.py force_sort_within_sections=1 diff --git a/examples/taxii_example.py b/examples/taxii_example.py index 688b918..166d028 100644 --- a/examples/taxii_example.py +++ b/examples/taxii_example.py @@ -1,4 +1,5 @@ import json + from stix2.sources.taxii import TAXIIDataSource # Flask TAXII server - developmental diff --git a/tox.ini b/tox.ini index f52a858..69ae434 100644 --- a/tox.ini +++ b/tox.ini @@ -30,7 +30,7 @@ max-line-length=160 [testenv:isort-check] deps = isort -commands = isort -rc stix2 -c -df +commands = isort -rc stix2 examples -c -df [travis] python =