Skip to content

Commit 927a833

Browse files
authored
Merge pull request #167 from kbase/develop
Merge Develop -> Main for release 0.0.22
2 parents d3edf07 + a486b20 commit 927a833

20 files changed

Lines changed: 389 additions & 57 deletions

.bandit.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
assert_used:
2+
skips: ['*_test.py', '*test_*.py']

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.0.22] 2022-08-15
9+
### Changed
10+
- The NCBI taxa scientfic name lookup queries below were updated to make use of the new
11+
NCBI taxa loader `species_or_below` flag and note that the `strain` flag is deprecated.
12+
See https://github.com/kbase/relation_engine_importers/blob/d8f87fb74e984cae1c94985b82349b13bc7f277e/docs/NCBI_taxa_sciname_lookup_issues_22_07.md
13+
- taxonomy_search_species_strain
14+
- taxonomy_search_species_strain_no_sort
15+
- The NCBI and GTDB taxon collections were updated to include the new flag.
16+
817
## [0.0.21] 2022-06-13
918
### Added
1019
- Dependabot

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.7-alpine
1+
FROM python:3.10-alpine
22

33
ARG DEVELOPMENT
44
ARG BUILD_DATE

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,10 @@ The CI service is available in the `relationapi` service
4949
* Merge from Develop to Main
5050
* Draft a release using semantic versioning (e.g 1.2.3) by creating a tag with the target of Main
5151
* Ensure release notes are updated manually and/or by AutoGenerate Release Notes
52+
53+
## Testing
54+
55+
To run tests:
56+
```
57+
make test
58+
```

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.21
1+
0.0.22

dev-requirements.txt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
mypy>=0.630
2-
bandit==1.5.1
1+
mypy>=0.971
2+
bandit==1.7.4
3+
# mccabe 0.7.0 is not compatible with flake8 4.0.1
34
mccabe==0.6.1
4-
flake8==3.5.0
5-
grequests==0.3.0
6-
coverage==5.2.1
7-
typed-ast>=1.4.0
8-
black==22.3.0
9-
pytest==6.2.5
10-
jinja2==3.0.3
5+
flake8==4.0.1
6+
grequests==0.6.0
7+
coverage==6.4.2
8+
black==22.6.0
9+
pytest==7.1.2
10+
python-arango==7.4.1
11+
frozendict==2.3.4

relation_engine_server/test/test_api_v1.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
_CONF = get_config()
1616

1717
# Use the mock auth tokens
18-
NON_ADMIN_TOKEN = "non_admin_token"
19-
ADMIN_TOKEN = "admin_token"
20-
INVALID_TOKEN = "invalid_token"
18+
NON_ADMIN_TOKEN = "non_admin_token" # nosec
19+
ADMIN_TOKEN = "admin_token" # nosec
20+
INVALID_TOKEN = "invalid_token" # nosec
2121

2222
# Use the docker-compose url of the running flask server
2323
URL = os.environ.get("TEST_URL", "http://localhost:5000")

relation_engine_server/test/test_json_validation.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ def test_non_validation_validator_errors(self):
160160
with self.assertRaisesRegex(TypeError, err_msg):
161161
run_validator(schema_file=test_file, data={})
162162

163-
# invalid jsonpointer string - note the grammar error is from jsonpointer
164-
err_str = "location must starts with /"
163+
# invalid jsonpointer string
164+
err_str = "Location must start with /"
165165
json_loc = "start validating here"
166166
with self.assertRaisesRegex(JsonPointerException, err_str):
167167
run_validator(schema=test_schema, data={}, validate_at=json_loc)
@@ -271,7 +271,7 @@ def test_pattern_validation(self, schema_arg=None, schema_file_arg=None):
271271
"distance": 3,
272272
},
273273
"file": "invalid_pattern",
274-
"err_str": '"what\'s-the-problem with-this-string\?" does not match .*?',
274+
"err_str": r'"what\'s-the-problem with-this-string\?" does not match .*?',
275275
},
276276
{
277277
"input": {"name": "No_problem_with_this_string", "distance": 3},
@@ -309,7 +309,7 @@ def test_uri_validation(self, schema_arg=None, schema_file_arg=None):
309309
{
310310
"input": {"name": "invalid_uri", "home_page": "where is it?"},
311311
"file": "invalid_uri",
312-
"err_str": "'where is it\?' is not a 'uri'",
312+
"err_str": r"'where is it\?' is not a 'uri'",
313313
},
314314
]
315315

@@ -350,7 +350,7 @@ def test_date_format_validation(self, schema_arg=None, schema_file_arg=None):
350350

351351
# pyyaml-specific issue: dates get automatically parsed into datetime objects (doh!)
352352
file_path = os_path.join(json_validation_dir, "unquoted_date.yaml")
353-
err_str = "datetime.date\(2020, 6, 6\) is not of type 'string'"
353+
err_str = r"datetime.date\(2020, 6, 6\) is not of type 'string'"
354354
with self.assertRaisesRegex(ValidationError, err_str):
355355
run_validator(
356356
schema=schema_arg,

relation_engine_server/test/test_spec_loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def test_get_schema_for_doc(self):
202202

203203
fake_name = "fake_name/12345"
204204
# a nonexistent file raises the appropriate error
205-
err_msg = f"Collection 'fake_name' does not exist."
205+
err_msg = "Collection 'fake_name' does not exist."
206206
with self.assertRaisesRegex(SchemaNonexistent, err_msg):
207207
spec_loader.get_schema_for_doc(fake_name, path_only=True)
208208

relation_engine_server/utils/ensure_specs.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -229,22 +229,25 @@ def excise_namespace(analyzer_name: str) -> str:
229229

230230

231231
def is_obj_subset_rec(
232-
l: Union[dict, list, float, str, int],
233-
r: Union[dict, list, float, str, int],
232+
left: Union[dict, list, float, str, int],
233+
right: Union[dict, list, float, str, int],
234234
):
235235
"""
236-
Compare two JSON objects, to see if, essentially, l <= r
236+
Compare two JSON objects, to see if, essentially, left <= right
237237
If comparing dicts, recursively compare
238238
If comparing lists, shallowly compare. For now, YAGN more
239239
"""
240-
if isinstance(l, dict) and isinstance(r, dict):
240+
if isinstance(left, dict) and isinstance(right, dict):
241241
return all(
242-
[k in r.keys() and is_obj_subset_rec(l[k], r[k]) for k in l.keys()]
242+
[
243+
k in right.keys() and is_obj_subset_rec(left[k], right[k])
244+
for k in left.keys()
245+
]
243246
) # ignore: typing
244-
elif isinstance(l, list) and isinstance(r, list):
245-
return all([le in r for le in l])
247+
elif isinstance(left, list) and isinstance(right, list):
248+
return all([le in right for le in left])
246249
else:
247-
return l == r # noqa: E741
250+
return left == right
248251

249252

250253
def mod_obj_literal(

0 commit comments

Comments
 (0)