Skip to content

Commit 44e3902

Browse files
committed
chore: Fix broken CI (aws#441)
1 parent e32b1c2 commit 44e3902

File tree

11 files changed

+67
-121
lines changed

11 files changed

+67
-121
lines changed

doc/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def get_version():
2929
return _release
3030

3131

32-
project = u"dynamodb-encryption-sdk-python" # pylint: disable=redundant-u-string-prefix
32+
project = "dynamodb-encryption-sdk-python"
3333
version = get_version()
3434
release = get_release()
3535

@@ -53,7 +53,7 @@ def get_version():
5353
source_suffix = ".rst" # The suffix of source filenames.
5454
master_doc = "index" # The master toctree document.
5555

56-
copyright = u"%s, Amazon" % datetime.now().year # pylint: disable=redefined-builtin,redundant-u-string-prefix
56+
copyright = "%s, Amazon" % datetime.now().year # pylint: disable=redefined-builtin
5757

5858
# List of directories, relative to source directory, that shouldn't be searched
5959
# for source files.

examples/src/pylintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
disable =
44
duplicate-code, # these examples often feature similar code
55
too-many-locals, # for these examples, we prioritize keeping everything together for simple readability
6+
consider-using-f-string, # Not supported in Python 3.5
67

78
[BASIC]
89
# Allow function names up to 50 characters

src/pylintrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
[MESSAGES CONTROL]
22
# Disabling messages that we either don't care about for tests or are necessary to break for tests.
33
disable =
4-
bad-continuation, # we let black handle this
54
ungrouped-imports, # we let isort handle this
65
duplicate-code, # causes lots of problems with implementations of common interfaces
76
# All below are disabled because we need to support Python 2
87
useless-object-inheritance,
98
raise-missing-from,
109
super-with-arguments,
11-
consider-using-f-string
10+
consider-using-f-string,
1211

1312
[BASIC]
1413
# Allow function names up to 50 characters

test/acceptance/acceptance_test_generators.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def load_scenarios(online):
4343
into a shared method.
4444
"""
4545
# pylint: disable=too-many-locals
46-
with open(_SCENARIO_FILE) as f:
46+
with open(_SCENARIO_FILE, encoding="utf-8") as f:
4747
scenarios = json.load(f)
4848
keys_file = _filename_from_uri(scenarios["keys"])
4949
keys = _load_keys(keys_file)
@@ -128,7 +128,7 @@ def _generate(materials_provider, table_data, ciphertext_file, metastore_info):
128128
if table:
129129
table.delete()
130130

131-
with open(ciphertext_file, "w") as outfile:
131+
with open(ciphertext_file, "w", encoding="utf-8") as outfile:
132132
json.dump(data_table_output, outfile, indent=4)
133133

134134
if metatable:
@@ -137,7 +137,7 @@ def _generate(materials_provider, table_data, ciphertext_file, metastore_info):
137137
metastore_output[metastore_info["table_name"]].append(ddb_to_json(wrapping_key))
138138

139139
metastore_ciphertext_file = _filename_from_uri(metastore_info["ciphertext"])
140-
with open(metastore_ciphertext_file, "w") as outfile:
140+
with open(metastore_ciphertext_file, "w", encoding="utf-8") as outfile:
141141
json.dump(metastore_output, outfile, indent=4)
142142

143143
metatable.delete()

test/acceptance/acceptance_test_utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def _decode_item(item):
6161

6262
def _build_plaintext_items(plaintext_file, version):
6363
# pylint: disable=too-many-locals
64-
with open(plaintext_file) as f:
64+
with open(plaintext_file, encoding="utf-8") as f:
6565
plaintext_data = json.load(f)
6666

6767
actions = {}
@@ -92,7 +92,7 @@ def _build_plaintext_items(plaintext_file, version):
9292

9393

9494
def _load_ciphertext_items(ciphertext_file):
95-
with open(ciphertext_file) as f:
95+
with open(ciphertext_file, encoding="utf-8") as f:
9696
ciphertexts = json.load(f)
9797

9898
for _table, items in ciphertexts.items():
@@ -103,7 +103,7 @@ def _load_ciphertext_items(ciphertext_file):
103103

104104

105105
def _load_keys(keys_file):
106-
with open(keys_file) as f:
106+
with open(keys_file, encoding="utf-8") as f:
107107
return json.load(f)
108108

109109

@@ -165,7 +165,7 @@ def _meta_table_prep(table_name, items_filename):
165165
table = boto3.resource("dynamodb", region_name="us-west-2").Table(table_name)
166166
table.wait_until_exists()
167167
try:
168-
with open(_filename_from_uri(items_filename)) as f:
168+
with open(_filename_from_uri(items_filename), encoding="utf-8") as f:
169169
table_data = json.load(f)
170170
request_items = {}
171171

@@ -255,7 +255,7 @@ def _expand_items(ciphertext_items, plaintext_items):
255255

256256
def load_scenarios(online):
257257
# pylint: disable=too-many-locals
258-
with open(_SCENARIO_FILE) as f:
258+
with open(_SCENARIO_FILE, encoding="utf-8") as f:
259259
scenarios = json.load(f)
260260
keys_file = _filename_from_uri(scenarios["keys"])
261261
keys = _load_keys(keys_file)

test/functional/functional_test_vector_generators.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ def _decode_complex_value(_value):
104104

105105
def attribute_test_vectors(mode):
106106
filepath = _ATTRIBUTE_TEST_VECTOR_FILE_TEMPLATE.format(mode=mode)
107-
with open(filepath) as f:
107+
with open(filepath, encoding="utf-8") as f:
108108
vectors = json.load(f)
109109
for vector in vectors:
110110
yield (decode_value(vector["attribute"]), base64.b64decode(codecs.encode(vector["serialized"], "utf-8")))
111111

112112

113113
def material_description_test_vectors():
114-
with open(_MATERIAL_DESCRIPTION_TEST_VECTORS_FILE) as f:
114+
with open(_MATERIAL_DESCRIPTION_TEST_VECTORS_FILE, encoding="utf-8") as f:
115115
vectors = json.load(f)
116116
for vector in vectors:
117117
yield (vector["material_description"], decode_value({"B": codecs.encode(vector["serialized"], "utf-8")}))
@@ -125,7 +125,7 @@ def material_description_test_vectors():
125125

126126

127127
def string_to_sign_test_vectors():
128-
with open(_STRING_TO_SIGN_TEST_VECTORS_FILE) as f:
128+
with open(_STRING_TO_SIGN_TEST_VECTORS_FILE, encoding="utf-8") as f:
129129
vectors = json.load(f)
130130
for vector in vectors:
131131
item = {key: decode_value(value["value"]) for key, value in vector["item"].items()}

test/functional/hypothesis_strategies.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
hypothesis.HealthCheck.too_slow,
2424
hypothesis.HealthCheck.data_too_large,
2525
hypothesis.HealthCheck.large_base_example,
26+
hypothesis.HealthCheck.function_scoped_fixture,
2627
),
2728
deadline=None,
2829
)

test/functional/internal/test_str_ops.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
(
2727
("asdf", "asdf"),
2828
(b"asdf", "asdf"),
29-
(codecs.encode(u"Предисловие", "utf-8"), u"Предисловие"),
30-
(u"Предисловие", u"Предисловие"),
29+
(codecs.encode("Предисловие", "utf-8"), "Предисловие"),
30+
("Предисловие", "Предисловие"),
3131
),
3232
)
3333
def test_to_str(data, expected_output):
@@ -41,8 +41,8 @@ def test_to_str(data, expected_output):
4141
("asdf", b"asdf"),
4242
(b"asdf", b"asdf"),
4343
(b"\x3a\x00\x99", b"\x3a\x00\x99"),
44-
(u"Предисловие", codecs.encode(u"Предисловие", "utf-8")),
45-
(codecs.encode(u"Предисловие", "utf-8"), codecs.encode(u"Предисловие", "utf-8")),
44+
("Предисловие", codecs.encode("Предисловие", "utf-8")),
45+
(codecs.encode("Предисловие", "utf-8"), codecs.encode("Предисловие", "utf-8")),
4646
),
4747
)
4848
def test_to_bytes(data, expected_output):

test/requirements.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
hypothesis>=5.0.0,<6.0.0;python_version>='3'
2-
hypothesis==4.57.1;python_version=='2.7'
1+
hypothesis==6.31.6
32
mock
4-
moto>=1.3.8;python_version>='3'
5-
# must be less than 2.2.x as Moto removed support for python2 as of moto 2.2.x.
6-
# https://github.com/spulec/moto/issues/3612
7-
moto>=1.3.8,<2.2.0;python_version=='2.7'
3+
moto==3.0.2
84
pytest>=3.4.0
95
pytest-cov
106
pytest-mock

test/upstream-requirements-py37.txt

Lines changed: 42 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,42 @@
1-
apipkg==1.5
2-
asn1crypto==1.0.1
3-
atomicwrites==1.3.0
4-
attrs==19.2.0
5-
aws-sam-translator==1.15.0
6-
aws-xray-sdk==2.4.2
7-
boto==2.49.0
8-
boto3==1.9.246
9-
botocore==1.12.246
10-
certifi==2019.9.11
11-
cffi==1.12.3
12-
cfn-lint==0.24.4
13-
chardet==3.0.4
14-
coverage==4.5.4
15-
cryptography==3.3.2
16-
DateTime==4.3
17-
docker==4.1.0
18-
docutils==0.15.2
19-
ecdsa==0.13.3
20-
execnet==1.7.1
21-
future==0.18.0
22-
hypothesis==4.40.0
23-
idna==2.8
24-
importlib-metadata==0.23
25-
Jinja2==2.11.3
26-
jmespath==0.9.4
27-
jsondiff==1.1.2
28-
jsonpatch==1.24
29-
jsonpickle==1.2
30-
jsonpointer==2.0
31-
jsonschema==3.1.1
32-
MarkupSafe==1.1.1
33-
mock==3.0.5
34-
more-itertools==7.2.0
35-
moto==1.3.13
36-
packaging==19.2
37-
pluggy==0.13.0
38-
py==1.10.0
39-
pyasn1==0.4.7
40-
pycparser==2.19
41-
pyparsing==2.4.2
42-
pyrsistent==0.15.4
43-
pytest==5.2.1
44-
pytest-cov==2.8.1
45-
pytest-forked==1.0.2
46-
pytest-mock==1.11.1
47-
pytest-xdist==1.30.0
48-
python-dateutil==2.8.0
49-
python-jose==3.0.1
50-
pytz==2019.3
51-
PyYAML==5.4
52-
requests==2.22.0
53-
responses==0.10.6
54-
rsa==4.5
55-
s3transfer==0.2.1
56-
six==1.12.0
57-
sshpubkeys==3.1.0
58-
urllib3==1.25.8
59-
wcwidth==0.1.7
60-
websocket-client==0.56.0
61-
Werkzeug==0.16.0
62-
wrapt==1.11.2
63-
xmltodict==0.12.0
64-
zipp==0.6.0
65-
zope.interface==4.6.0
1+
attrs==22.1.0
2+
boto3==1.26.9
3+
botocore==1.29.9
4+
certifi==2022.9.24
5+
cffi==1.15.1
6+
charset-normalizer==2.1.1
7+
coverage==6.5.0
8+
cryptography==38.0.3
9+
exceptiongroup==1.0.3
10+
execnet==1.9.0
11+
hypothesis==6.31.6
12+
idna==3.4
13+
importlib-metadata==5.0.0
14+
iniconfig==1.1.1
15+
Jinja2==3.1.2
16+
jmespath==1.0.1
17+
MarkupSafe==2.1.1
18+
mock==4.0.3
19+
moto==3.0.2
20+
packaging==21.3
21+
pluggy==1.0.0
22+
pycparser==2.21
23+
pyparsing==3.0.9
24+
pytest==7.2.0
25+
pytest-cov==4.0.0
26+
pytest-mock==3.10.0
27+
pytest-xdist==3.0.2
28+
python-dateutil==2.8.2
29+
pytz==2022.6
30+
requests==2.28.1
31+
responses==0.22.0
32+
s3transfer==0.6.0
33+
six==1.16.0
34+
sortedcontainers==2.4.0
35+
toml==0.10.2
36+
tomli==2.0.1
37+
types-toml==0.10.8.1
38+
typing_extensions==4.4.0
39+
urllib3==1.26.12
40+
Werkzeug==2.2.2
41+
xmltodict==0.13.0
42+
zipp==3.10.0

tox.ini

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[tox]
22
envlist =
3-
py{27,35,36,37,38,39}-{local,integ,ddb,examples}-fast,
3+
py{37,38,39}-{local,integ,ddb,examples}-fast,
44
nocmk, sourcebuildcheck,
55
docs, bandit, doc8, readme,
66
flake8{,-tests,-examples}, pylint{,-tests,-examples},
77
vulture,
8-
test-upstream-requirements-py{2,3}7
8+
test-upstream-requirements-py37
99

1010
# Additional environments:
1111
#
@@ -117,15 +117,6 @@ recreate = True
117117
deps =
118118
commands = {toxinidir}/test/freeze-upstream-requirements.sh
119119

120-
# Freeze for Python 2.7
121-
[testenv:freeze-upstream-requirements-py27]
122-
basepython = python2.7
123-
sitepackages = {[testenv:freeze-upstream-requirements-base]sitepackages}
124-
skip_install = {[testenv:freeze-upstream-requirements-base]skip_install}
125-
recreate = {[testenv:freeze-upstream-requirements-base]recreate}
126-
deps = {[testenv:freeze-upstream-requirements-base]deps}
127-
commands = {[testenv:freeze-upstream-requirements-base]commands} test/upstream-requirements-py27.txt
128-
129120
# Freeze for Python 3.7
130121
[testenv:freeze-upstream-requirements-py37]
131122
basepython = python3.7
@@ -142,15 +133,6 @@ recreate = True
142133
passenv =
143134
commands = {[testenv:base-command]commands} -m "local and not slow and not veryslow and not nope" --ignore=examples
144135

145-
# Test frozen upstream requirements for Python 2.7
146-
[testenv:test-upstream-requirements-py27]
147-
basepython = python2.7
148-
passenv =
149-
deps = -rtest/upstream-requirements-py27.txt
150-
sitepackages = {[testenv:test-upstream-requirements-base]sitepackages}
151-
recreate = {[testenv:test-upstream-requirements-base]recreate}
152-
commands = {[testenv:test-upstream-requirements-base]commands}
153-
154136
# Test frozen upstream requirements for Python 3.7
155137
[testenv:test-upstream-requirements-py37]
156138
basepython = python3.7
@@ -201,17 +183,6 @@ commands =
201183
{posargs}
202184
{[testenv:mypy-coverage]commands}
203185

204-
[testenv:mypy-py2]
205-
basepython = python2.7
206-
deps = {[testenv:mypy-common]deps}
207-
commands =
208-
python -m mypy \
209-
--py2 \
210-
--linecoverage-report build \
211-
src/dynamodb_encryption_sdk/ \
212-
{posargs}
213-
{[testenv:mypy-coverage]commands}
214-
215186
# Linters
216187
[testenv:flake8]
217188
basepython = python3
@@ -266,6 +237,7 @@ commands =
266237
[testenv:pylint-tests]
267238
basepython = {[testenv:pylint]basepython}
268239
deps = {[testenv:pylint]deps}
240+
moto==3.0.2
269241
commands =
270242
pylint \
271243
--rcfile=test/pylintrc \

0 commit comments

Comments
 (0)