Skip to content

Commit 0b621c9

Browse files
authoredApr 19, 2018
Merge pull request #7 from mattsb42-aws/config-2
test configuration tweaks and cleanup
2 parents 852275c + 317d17e commit 0b621c9

File tree

6 files changed

+29
-13
lines changed

6 files changed

+29
-13
lines changed
 

‎setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ markers =
1919
unit: mark test as a unit test (does not require network access)
2020
functional: mark test as a functional test (does not require network access)
2121
integ: mark a test as an integration test (requires network access)
22+
hypothesis: mark a test as using hypothesis (will run many times for each pytest call)
2223
slow: mark a test as being known to take a long time to complete (order 5s < t < 60s)
2324
veryslow: mark a test as being known to take a very long time to complete (order t > 60s)
2425
nope: mark a test as being so slow that it should only be very infrequently (order t > 30m)

‎test/functional/hypothesis_strategies.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717

1818
from boto3.dynamodb.types import Binary, DYNAMODB_CONTEXT
1919
import hypothesis
20-
from hypothesis.strategies import binary, booleans, dictionaries, deferred, fractions, just, lists, none, sets, text
20+
from hypothesis.strategies import (
21+
binary, booleans, characters, dictionaries, deferred, fractions, just, lists, none, sets, text
22+
)
2123

2224
SLOW_SETTINGS = hypothesis.settings(
2325
suppress_health_check=(
@@ -49,7 +51,10 @@
4951
)
5052

5153

52-
ddb_string = text(min_size=1, max_size=MAX_ITEM_BYTES)
54+
ddb_string = text(
55+
min_size=1,
56+
max_size=MAX_ITEM_BYTES
57+
)
5358
ddb_string_set = sets(ddb_string, min_size=1)
5459

5560

@@ -89,9 +94,13 @@ def _ddb_fraction_to_decimal(val):
8994
| ddb_number_set
9095
| ddb_binary_set
9196
)
97+
ddb_attribute_names = text(
98+
min_size=1,
99+
max_size=255
100+
)
92101
# TODO: List and Map types have a max depth of 32
93102
ddb_map_type = deferred(lambda: dictionaries(
94-
keys=text(),
103+
keys=ddb_attribute_names,
95104
values=(
96105
ddb_scalar_types
97106
| ddb_set_types
@@ -112,7 +121,7 @@ def _ddb_fraction_to_decimal(val):
112121
ddb_attribute_values = ddb_scalar_types | ddb_set_types | ddb_list_type
113122

114123
ddb_items = dictionaries(
115-
keys=text(min_size=1, max_size=255),
124+
keys=ddb_attribute_names,
116125
values=ddb_scalar_types | ddb_set_types | ddb_list_type
117126
)
118127

‎test/functional/test_f_formatting_attribute_serialization.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,15 @@ def _serialize_deserialize_cycle(attribute):
7373

7474

7575
@pytest.mark.slow
76+
@pytest.mark.hypothesis
7677
@SLOW_SETTINGS
7778
@hypothesis.given(ddb_attribute_values)
7879
def test_serialize_deserialize_attribute_slow(attribute):
7980
_serialize_deserialize_cycle(attribute)
8081

8182

8283
@pytest.mark.veryslow
84+
@pytest.mark.hypothesis
8385
@VERY_SLOW_SETTINGS
8486
@hypothesis.given(ddb_attribute_values)
8587
def test_serialize_deserialize_attribute_vslow(attribute):
@@ -93,13 +95,15 @@ def _ddb_dict_ddb_transform_cycle(item):
9395

9496

9597
@pytest.mark.slow
98+
@pytest.mark.hypothesis
9699
@SLOW_SETTINGS
97100
@hypothesis.given(ddb_items)
98101
def test_dict_to_ddb_and_back_slow(item):
99102
_ddb_dict_ddb_transform_cycle(item)
100103

101104

102105
@pytest.mark.veryslow
106+
@pytest.mark.hypothesis
103107
@VERY_SLOW_SETTINGS
104108
@hypothesis.given(ddb_items)
105109
def test_dict_to_ddb_and_back_vslow(item):

‎test/functional/test_f_formatting_material_description_serialization.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,15 @@ def _serialize_deserialize_cycle(material_description):
7777

7878

7979
@pytest.mark.slow
80+
@pytest.mark.hypothesis
8081
@SLOW_SETTINGS
8182
@hypothesis.given(material_descriptions)
8283
def test_serialize_deserialize_material_description_slow(material_description):
8384
_serialize_deserialize_cycle(material_description)
8485

8586

8687
@pytest.mark.veryslow
88+
@pytest.mark.hypothesis
8789
@VERY_SLOW_SETTINGS
8890
@hypothesis.given(material_descriptions)
8991
def test_serialize_deserialize_material_description_vslow(material_description):

‎test/requirements.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
hypothesis
2+
mock
3+
git+https://github.com/spulec/moto.git
4+
pytest>=3.3.1
5+
pytest-cov
6+
pytest-mock
7+
pytest-xdist

‎tox.ini

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
envlist =
3-
py{27,34,35,36}-{local,integ}-full,
3+
py{27,34,35,36}-{local,integ}-fast,
44
bandit, doc8, readme,
55
flake8, pylint,
66
flake8-tests, pylint-tests,
@@ -23,14 +23,7 @@ passenv =
2323
# Pass through AWS profile name (useful for local testing)
2424
AWS_PROFILE
2525
sitepackages = False
26-
deps =
27-
hypothesis
28-
mock
29-
moto
30-
pytest>=3.3.1
31-
pytest-cov
32-
pytest-mock
33-
pytest-xdist
26+
deps = -rtest/requirements.txt
3427
commands =
3528
local-fast: {[testenv:base-command]commands} -m "local and not slow and not veryslow and not nope"
3629
integ-fast: {[testenv:base-command]commands} -m "integ and not slow and not veryslow and not nope"

0 commit comments

Comments
 (0)