diff --git a/stix2/test/fixtures.py b/stix2/test/conftest.py similarity index 100% rename from stix2/test/fixtures.py rename to stix2/test/conftest.py diff --git a/stix2/test/test_bundle.py b/stix2/test/test_bundle.py index 03ac640..39ca2d5 100644 --- a/stix2/test/test_bundle.py +++ b/stix2/test/test_bundle.py @@ -2,8 +2,6 @@ import pytest import stix2 -from .fixtures import clock, uuid4, indicator, malware, relationship # noqa: F401 - EXPECTED_BUNDLE = """{ "id": "bundle--00000000-0000-0000-0000-000000000004", "objects": [ @@ -73,13 +71,13 @@ def test_bundle_with_wrong_spec_version(): assert str(excinfo.value) == "Invalid value for Bundle 'spec_version': must equal '2.0'." -def test_create_bundle(indicator, malware, relationship): # noqa: F811 +def test_create_bundle(indicator, malware, relationship): bundle = stix2.Bundle(objects=[indicator, malware, relationship]) assert str(bundle) == EXPECTED_BUNDLE -def test_create_bundle_with_positional_args(indicator, malware, relationship): # noqa: F811 +def test_create_bundle_with_positional_args(indicator, malware, relationship): bundle = stix2.Bundle(indicator, malware, relationship) assert str(bundle) == EXPECTED_BUNDLE diff --git a/stix2/test/test_fixtures.py b/stix2/test/test_fixtures.py index 5c0409e..9078972 100644 --- a/stix2/test/test_fixtures.py +++ b/stix2/test/test_fixtures.py @@ -2,14 +2,13 @@ import datetime as dt import uuid from .constants import FAKE_TIME -from .fixtures import clock, uuid4 # noqa: F401 -def test_clock(clock): # noqa: F811 +def test_clock(clock): assert dt.datetime.now() == FAKE_TIME -def test_my_uuid4_fixture(uuid4): # noqa: F811 +def test_my_uuid4_fixture(uuid4): assert uuid.uuid4() == "00000000-0000-0000-0000-000000000001" assert uuid.uuid4() == "00000000-0000-0000-0000-000000000002" assert uuid.uuid4() == "00000000-0000-0000-0000-000000000003" diff --git a/stix2/test/test_indicator.py b/stix2/test/test_indicator.py index 11197ed..d6d92cd 100644 --- a/stix2/test/test_indicator.py +++ b/stix2/test/test_indicator.py @@ -6,7 +6,6 @@ import pytz import stix2 from .constants import FAKE_TIME, INDICATOR_ID, INDICATOR_KWARGS -from .fixtures import clock, uuid4, indicator # noqa: F401 EXPECTED_INDICATOR = """{ "created": "2017-01-01T00:00:01Z", @@ -49,7 +48,7 @@ def test_indicator_with_all_required_fields(): assert repr(ind) == EXPECTED_INDICATOR_REPR -def test_indicator_autogenerated_fields(indicator): # noqa: F811 +def test_indicator_autogenerated_fields(indicator): assert indicator.type == 'indicator' assert indicator.id == 'indicator--00000000-0000-0000-0000-000000000001' assert indicator.created == FAKE_TIME @@ -105,7 +104,7 @@ def test_indicator_revoked_invalid(): assert str(excinfo.value) == "Invalid value for Indicator 'revoked': must be a boolean value." -def test_cannot_assign_to_indicator_attributes(indicator): # noqa: F811 +def test_cannot_assign_to_indicator_attributes(indicator): with pytest.raises(ValueError) as excinfo: indicator.valid_from = dt.datetime.now() diff --git a/stix2/test/test_malware.py b/stix2/test/test_malware.py index 0538920..7745663 100644 --- a/stix2/test/test_malware.py +++ b/stix2/test/test_malware.py @@ -6,7 +6,6 @@ import pytz import stix2 from .constants import FAKE_TIME, MALWARE_ID, MALWARE_KWARGS -from .fixtures import clock, uuid4, malware # noqa: F401 EXPECTED_MALWARE = """{ "created": "2016-05-12T08:17:27Z", @@ -35,7 +34,7 @@ def test_malware_with_all_required_fields(): assert str(mal) == EXPECTED_MALWARE -def test_malware_autogenerated_fields(malware): # noqa: F811 +def test_malware_autogenerated_fields(malware): assert malware.type == 'malware' assert malware.id == 'malware--00000000-0000-0000-0000-000000000001' assert malware.created == FAKE_TIME @@ -77,7 +76,7 @@ def test_malware_required_field_name(): assert str(excinfo.value) == "Missing required field(s) for Malware: (name)." -def test_cannot_assign_to_malware_attributes(malware): # noqa: F811 +def test_cannot_assign_to_malware_attributes(malware): with pytest.raises(ValueError) as excinfo: malware.name = "Cryptolocker II" diff --git a/stix2/test/test_relationship.py b/stix2/test/test_relationship.py index a501ea6..0c96bb1 100644 --- a/stix2/test/test_relationship.py +++ b/stix2/test/test_relationship.py @@ -7,7 +7,6 @@ import stix2 from .constants import FAKE_TIME, INDICATOR_ID, MALWARE_ID, RELATIONSHIP_ID from .constants import RELATIONSHIP_KWARGS -from .fixtures import clock, uuid4, indicator, malware, relationship # noqa: F401 EXPECTED_RELATIONSHIP = """{ @@ -36,7 +35,7 @@ def test_relationship_all_required_fields(): assert str(rel) == EXPECTED_RELATIONSHIP -def test_relationship_autogenerated_fields(relationship): # noqa: F811 +def test_relationship_autogenerated_fields(relationship): assert relationship.type == 'relationship' assert relationship.id == 'relationship--00000000-0000-0000-0000-000000000001' assert relationship.created == FAKE_TIME @@ -89,7 +88,7 @@ def test_relationship_required_field_target_ref(): assert str(excinfo.value) == "Missing required field(s) for Relationship: (target_ref)." -def test_cannot_assign_to_relationship_attributes(relationship): # noqa: F811 +def test_cannot_assign_to_relationship_attributes(relationship): with pytest.raises(ValueError) as excinfo: relationship.relationship_type = "derived-from" @@ -102,7 +101,7 @@ def test_invalid_kwarg_to_relationship(): assert str(excinfo.value) == "unexpected keyword arguments: ['my_custom_property']" in str(excinfo) -def test_create_relationship_from_objects_rather_than_ids(indicator, malware): # noqa: F811 +def test_create_relationship_from_objects_rather_than_ids(indicator, malware): rel = stix2.Relationship( relationship_type="indicates", source_ref=indicator, @@ -115,7 +114,7 @@ def test_create_relationship_from_objects_rather_than_ids(indicator, malware): assert rel.id == 'relationship--00000000-0000-0000-0000-000000000003' -def test_create_relationship_with_positional_args(indicator, malware): # noqa: F811 +def test_create_relationship_with_positional_args(indicator, malware): rel = stix2.Relationship(indicator, 'indicates', malware) assert rel.relationship_type == 'indicates' diff --git a/tox.ini b/tox.ini index 62c57d0..fd580f9 100644 --- a/tox.ini +++ b/tox.ini @@ -17,6 +17,9 @@ commands = ignore= max-line-length=160 +[flake8] +max-line-length=160 + [travis] python = 2.6: py26