Commit Graph

39 Commits (9933f88975652b35f06e6cfb5d8f158f2578551b)

Author SHA1 Message Date
Chris Lenk 76439d1ce9 Redo pyyaml workaround for travis 2020-01-08 13:22:08 -05:00
Chris Lenk 8140258d81 Set pyyaml version for Python3.4 2020-01-08 09:44:49 -05:00
Chris Lenk 4aaf1a0be7 Fix typo 2020-01-04 13:55:04 -05:00
Chris Lenk 6c0fba0e67 Add Python3.8 support, fix import
Uses try/catch to still support 2.7 too
2020-01-04 13:50:06 -05:00
Chris Lenk 62cd4fd33c Change string semantic comparison algorithm
Use `fuzzywuzzy`'s Token Sort Ratio instead of Jaro-Winkler.
2019-12-23 17:00:52 -05:00
Emmanuelle Vargas-Gonzalez 88b883c91d
Merge branch 'master' into semantic-equivalence 2019-09-23 23:20:42 -04:00
Emmanuelle Vargas-Gonzalez dc79a1f869 add docstrings for new public methods. add test with disabled spec_version check.
fix calculation for distance, using incorrect algorithm. update package settings, tox settings
2019-09-23 23:13:50 -04:00
Chris Lenk 401c9ad950
Merge branch 'master' into stix2.1 2019-09-23 12:26:27 -04:00
Emmanuelle Vargas-Gonzalez ea0df70806 update test environment requirements 2019-09-16 14:45:01 -04:00
Chris Lenk 4fafdfecff Update readme check 2019-08-12 12:28:27 -04:00
Michael Chisholm bb4a6b1bcb Change how tox invokes pytest, to workaround a seeming tox
bug which seems to be related to how it copes with code which
emits warnings.
2019-08-08 15:22:21 -04:00
Michael Chisholm 5e5a03c001 Changed emitted deprecation warnings to a custom DeprecationWarning
subclass.  Changed the unit test to test for that specific
warning category, instead of any DeprecationWarning.
2019-08-07 10:16:18 -04:00
Michael Chisholm 5589480980 Improved the exception class hierarchy:
- Removed all plain python base classes (e.g. ValueError, TypeError)
- Renamed InvalidPropertyConfigurationError -> PropertyPresenceError,
  since incorrect values could be considered a property config error, and
  I really just wanted this class to apply to presence (co-)constraint
  violations.
- Added ObjectConfigurationError as a superclass of InvalidValueError,
  PropertyPresenceError, and any other exception that could be raised
  during _STIXBase object init, which is when the spec compliance
  checks happen.  This class is intended to represent general spec
  violations.
- Did some class reordering in exceptions.py, so all the
  ObjectConfigurationError subclasses were together.

Changed how property "cleaning" errors were handled:
- Previous docs said they should all be ValueErrors, but that would require
  extra exception check-and-replace complexity in the property
  implementations, so that requirement is removed.  Doc is changed to just
  say that cleaning problems should cause exceptions to be raised.
  _STIXBase._check_property() now handles most exception types, not just
  ValueError.
- Decided to try chaining the original clean error to the InvalidValueError,
  in case the extra diagnostics would be helpful in the future.  This is
  done via 'six' adapter function and only works on python3.
- A small amount of testing was removed, since it was looking at custom
  exception properties which became unavailable once the exception was
  replaced with InvalidValueError.

Did another pass through unit tests to fix breakage caused by the changed
exception class hierarchy.

Removed unnecessary observable extension handling code from
parse_observable(), since it was all duplicated in ExtensionsProperty.
The redundant code in parse_observable() had different exception behavior
than ExtensionsProperty, which makes the API inconsistent and unit tests
more complicated.  (Problems in ExtensionsProperty get replaced with
InvalidValueError, but extensions problems handled directly in
parse_observable() don't get the same replacement, and so the exception
type is different.)

Redid the workbench monkeypatching.  The old way was impossible to make
work, and had caused ugly ripple effect hackage in other parts of the
codebase.  Now, it replaces the global object maps with factory functions
which behave the same way when called, as real classes.  Had to fix up a
few unit tests to get them all passing with this monkeypatching in place.
Also remove all the xfail markings in the workbench test suite, since all
tests now pass.

Since workbench monkeypatching isn't currently affecting any unit tests,
tox.ini was simplified to remove the special-casing for running the
workbench tests.

Removed the v20 workbench test suite, since the workbench currently only
works with the latest stix object version.
2019-07-19 14:50:11 -04:00
Emmanuelle Vargas-Gonzalez b2ef77b322 Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into stix2.1 2018-10-17 07:30:23 -04:00
Maciej Urbanski e80fb4f59a
python 3.7 support 2018-10-03 18:00:38 +02:00
Emmanuelle Vargas-Gonzalez 99e76c26ae Update Tox test configuration 2018-07-10 14:39:20 -04:00
Greg Back 3f80c07342 Add tox checks for README. 2018-05-02 12:37:44 -05:00
Emmanuelle Vargas-Gonzalez 7788ad8583 Add `medallion` dependency to Travis CI tests 2018-04-23 14:26:26 -04:00
Emmanuelle Vargas-Gonzalez 99a8f9e871 Merge branch 'master' into issue-148
# Conflicts:
#	stix2/test/test_datastore.py
#	tox.ini
2018-04-23 11:04:28 -04:00
Chris Lenk 1d22c757ef Improve Tox test harness
- No need for both pycodestyle and flake8; flake8 includes the former.
- Use the proper pytest invocation.
2018-04-11 15:40:52 -04:00
Emmanuelle Vargas-Gonzalez 4d35cc6f28 WIP: Update tox.ini 2018-04-06 14:25:06 -04:00
Greg Back a1ad90d43f
Merge pull request #150 from oasis-open/38-workbench
Create Workbench layer
2018-04-05 10:09:23 -05:00
Emmanuelle Vargas-Gonzalez c518533275 Update stix2 setup configuration
# Remove taxii2-client as a requirement to install stix2
# Add taxii2-client to the Tox configuration instead
# Re-factor the version and description loading
2018-04-02 07:51:51 -04:00
Chris Lenk 4424809225 Fix tox config (coverage was incorrectly reported) 2018-03-30 12:02:27 -04:00
Chris Lenk 5285934034 Make Workbench use implicit ObjectFactory
This is needed to implement functions like `set_default_creator`.

The changes to Tox are so that the wrapping we do in workbench doesn't
affect the rest of our tests. If we test them all in one go, pytest will
import all the tests before running any of them. This will cause the
workbench versions of the SDO classes to be used in all tests.
2018-03-30 12:02:27 -04:00
Greg Back c0669d7a5f Drop support for Python 3.3 2017-11-29 22:11:40 +00:00
Emmanuelle Vargas-Gonzalez 04450112bf Small change to tox.ini 2017-09-11 10:28:46 -04:00
Chris Lenk 42962e6675 Improve markings tests
- Test markings functions with both dictionaries and our _STIXBase-derived
  classes as input.
- Slightly improve test coverage.
- Drop Python 2.6 support.
2017-09-01 16:41:16 -04:00
clenk 5c5903179d Fix import sort order 2017-07-14 16:02:29 -04:00
clenk 229ab5d323 Fix import order 2017-06-01 17:17:03 -04:00
clenk 61c1e07433 Move codecov invocation from Tox to Travis
This avoids errors when running Tox locally.
Also display line numbers missing test coverage.
2017-06-01 17:00:22 -04:00
clenk 67935d08fe Fix isort settings, rename Observable to clarify
it's an internal class
2017-05-09 18:03:46 -04:00
clenk bdd18be6c3 Switch to isort for checking import order
because it has a pre-commit hook
2017-05-09 15:10:53 -04:00
Greg Back 85b5a1971b Merge pull request #2 from MISP/testing
Add code coverage report
2017-05-05 10:17:51 -05:00
clenk cd815bfe84 Fix import order, add flake8-import-order plugin
to Tox
2017-04-24 18:29:56 -04:00
Raphaël Vinot 83997b1135 Add code coverage report 2017-04-18 10:58:39 +02:00
Greg Back 1517eb899b Move fixtures to conftest.py 2017-04-07 15:36:42 -05:00
Greg Back 116c784d5c Add flake8 checks to tox config 2017-03-22 08:13:14 -05:00
Greg Back 3bcc327813 Add tox support. 2017-02-02 10:28:16 -06:00