Skip to content

test configuration tweaks and cleanup #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ markers =
unit: mark test as a unit test (does not require network access)
functional: mark test as a functional test (does not require network access)
integ: mark a test as an integration test (requires network access)
hypothesis: mark a test as using hypothesis (will run many times for each pytest call)
slow: mark a test as being known to take a long time to complete (order 5s < t < 60s)
veryslow: mark a test as being known to take a very long time to complete (order t > 60s)
nope: mark a test as being so slow that it should only be very infrequently (order t > 30m)
Expand Down
17 changes: 13 additions & 4 deletions test/functional/hypothesis_strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

from boto3.dynamodb.types import Binary, DYNAMODB_CONTEXT
import hypothesis
from hypothesis.strategies import binary, booleans, dictionaries, deferred, fractions, just, lists, none, sets, text
from hypothesis.strategies import (
binary, booleans, characters, dictionaries, deferred, fractions, just, lists, none, sets, text
)

SLOW_SETTINGS = hypothesis.settings(
suppress_health_check=(
Expand Down Expand Up @@ -49,7 +51,10 @@
)


ddb_string = text(min_size=1, max_size=MAX_ITEM_BYTES)
ddb_string = text(
min_size=1,
max_size=MAX_ITEM_BYTES
)
ddb_string_set = sets(ddb_string, min_size=1)


Expand Down Expand Up @@ -89,9 +94,13 @@ def _ddb_fraction_to_decimal(val):
| ddb_number_set
| ddb_binary_set
)
ddb_attribute_names = text(
min_size=1,
max_size=255
)
# TODO: List and Map types have a max depth of 32
ddb_map_type = deferred(lambda: dictionaries(
keys=text(),
keys=ddb_attribute_names,
values=(
ddb_scalar_types
| ddb_set_types
Expand All @@ -112,7 +121,7 @@ def _ddb_fraction_to_decimal(val):
ddb_attribute_values = ddb_scalar_types | ddb_set_types | ddb_list_type

ddb_items = dictionaries(
keys=text(min_size=1, max_size=255),
keys=ddb_attribute_names,
values=ddb_scalar_types | ddb_set_types | ddb_list_type
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@ def _serialize_deserialize_cycle(attribute):


@pytest.mark.slow
@pytest.mark.hypothesis
@SLOW_SETTINGS
@hypothesis.given(ddb_attribute_values)
def test_serialize_deserialize_attribute_slow(attribute):
_serialize_deserialize_cycle(attribute)


@pytest.mark.veryslow
@pytest.mark.hypothesis
@VERY_SLOW_SETTINGS
@hypothesis.given(ddb_attribute_values)
def test_serialize_deserialize_attribute_vslow(attribute):
Expand All @@ -93,13 +95,15 @@ def _ddb_dict_ddb_transform_cycle(item):


@pytest.mark.slow
@pytest.mark.hypothesis
@SLOW_SETTINGS
@hypothesis.given(ddb_items)
def test_dict_to_ddb_and_back_slow(item):
_ddb_dict_ddb_transform_cycle(item)


@pytest.mark.veryslow
@pytest.mark.hypothesis
@VERY_SLOW_SETTINGS
@hypothesis.given(ddb_items)
def test_dict_to_ddb_and_back_vslow(item):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,15 @@ def _serialize_deserialize_cycle(material_description):


@pytest.mark.slow
@pytest.mark.hypothesis
@SLOW_SETTINGS
@hypothesis.given(material_descriptions)
def test_serialize_deserialize_material_description_slow(material_description):
_serialize_deserialize_cycle(material_description)


@pytest.mark.veryslow
@pytest.mark.hypothesis
@VERY_SLOW_SETTINGS
@hypothesis.given(material_descriptions)
def test_serialize_deserialize_material_description_vslow(material_description):
Expand Down
7 changes: 7 additions & 0 deletions test/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
hypothesis
mock
git+https://github.com/spulec/moto.git
pytest>=3.3.1
pytest-cov
pytest-mock
pytest-xdist
11 changes: 2 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py{27,34,35,36}-{local,integ}-full,
py{27,34,35,36}-{local,integ}-fast,
bandit, doc8, readme,
flake8, pylint,
flake8-tests, pylint-tests,
Expand All @@ -23,14 +23,7 @@ passenv =
# Pass through AWS profile name (useful for local testing)
AWS_PROFILE
sitepackages = False
deps =
hypothesis
mock
moto
pytest>=3.3.1
pytest-cov
pytest-mock
pytest-xdist
deps = -rtest/requirements.txt
commands =
local-fast: {[testenv:base-command]commands} -m "local and not slow and not veryslow and not nope"
integ-fast: {[testenv:base-command]commands} -m "integ and not slow and not veryslow and not nope"
Expand Down