-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from OCHA-DAP/add_tests
HAPI-154 Add functional tests
- Loading branch information
Showing
27 changed files
with
10,888 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# This workflow will install Python dependencies, lint and run tests | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: Run tests | ||
|
||
on: | ||
workflow_dispatch: # add run button in github | ||
push: | ||
branches-ignore: | ||
- gh-pages | ||
- 'dependabot/**' | ||
pull_request: | ||
branches-ignore: | ||
- gh-pages | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --upgrade hatch | ||
- name: Test with hatch/pytest | ||
run: | | ||
hatch run test:test | ||
- name: Check styling | ||
if: always() | ||
run: | | ||
hatch run lint:style | ||
- name: Publish Unit Test Results | ||
uses: EnricoMi/publish-unit-test-result-action@v2 | ||
if: always() | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
junit_files: test-results.xml | ||
- name: Publish in Coveralls | ||
uses: coverallsapp/github-action@v2 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
flag-name: tests | ||
format: lcov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from os.path import join | ||
from typing import Dict | ||
|
||
from hdx.utilities.loader import load_and_merge_yaml | ||
from hdx.utilities.path import script_dir_plus_file | ||
from hdx.utilities.typehint import ListTuple | ||
|
||
|
||
def load_yamls(config_files: ListTuple[str]) -> Dict: | ||
input_files = [ | ||
script_dir_plus_file(join("..", "configs", file), load_yamls) | ||
for file in config_files | ||
] | ||
project_config = load_and_merge_yaml(input_files) | ||
return project_config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
tests/fixtures/input/afghanistan-who-does-what-where-january-to-march-2023.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"archived": false, "creator_user_id": "391f0864-b6e4-425f-9d46-df87aa456c2b", "data_update_frequency": "180", "dataseries_name": "OCHA Afghanistan - Who does What Where", "dataset_date": "[2023-01-01T00:00:00 TO 2023-03-31T23:59:59]", "dataset_preview": "resource_id", "dataset_source": "Humanitarian partners", "due_date": "2023-11-05T07:35:47", "has_geodata": false, "has_quickcharts": true, "has_showcases": true, "id": "f50bc211-d42f-4fcd-8291-3e4a57a0dfcf", "is_requestdata_type": false, "isopen": true, "last_modified": "2023-05-09T07:35:47.682796", "license_id": "cc-by", "license_title": "Creative Commons Attribution International", "license_url": "http://www.opendefinition.org/licenses/cc-by", "maintainer": "391f0864-b6e4-425f-9d46-df87aa456c2b", "maintainer_email": "[email protected]", "metadata_created": "2023-05-04T06:04:43.041555", "metadata_modified": "2023-09-07T08:36:12.493166", "methodology": "Direct Observational Data/Anecdotal Data", "name": "afghanistan-who-does-what-where-january-to-march-2023", "notes": "The Who does What Where (3W) is a core humanitarian coordination dataset. It is critical to know where humanitarian organizations are working, what they are doing and their capability in order to identify gaps, avoid duplication of efforts, and plan for future humanitarian response (if needed). The data includes a list of humanitarian organizations by district and cluster, as well as a unique count of organizations. An interactive map of the 3W data can be accessed [here](https://www.humanitarianresponse.info/en/operations/afghanistan/3w). ", "num_resources": 3, "num_tags": 4, "organization": {"id": "10e168ce-5b51-49ac-8616-a142d48618e5", "name": "ocha-afghanistan", "title": "OCHA Afghanistan", "type": "organization", "description": "OCHA resumed its operation in Afghanistan in 2009, providing humanitarian assistance in a complex environment where separate \u2013 and not always complementary \u2013 military, political and security objectives pose challenges to the implementation of humanitarian principles, the ability of responders to reach people in need and the safety and security of aid workers", "image_url": "", "created": "2014-08-06T14:26:07.642577", "is_organization": true, "approval_status": "approved", "state": "active"}, "overdue_date": "2023-12-05T07:35:47", "owner_org": "10e168ce-5b51-49ac-8616-a142d48618e5", "package_creator": "murtaza", "pageviews_last_14_days": 1, "private": false, "qa_completed": false, "solr_additions": "{\"countries\": [\"Afghanistan\"]}", "state": "active", "subnational": "1", "title": "Afghanistan - Who does What Where (January to March 2023)", "total_res_downloads": 129, "type": "dataset", "url": null, "version": null, "groups": [{"description": "", "display_name": "Afghanistan", "id": "afg", "image_display_url": "", "name": "afg", "title": "Afghanistan"}], "tags": [{"display_name": "hxl", "id": "a0fbb23a-6aad-4ccc-8062-e9ef9f20e5d2", "name": "hxl", "state": "active", "vocabulary_id": "b891512e-9516-4bf5-962a-7a289772a2a1"}, {"display_name": "operational capacity", "id": "d8a59526-9f9a-4c71-b38f-5d9f2eb1615a", "name": "operational capacity", "state": "active", "vocabulary_id": "b891512e-9516-4bf5-962a-7a289772a2a1"}, {"display_name": "operational presence", "id": "a25059f9-7e1f-49be-b629-ccccd97a95f8", "name": "operational presence", "state": "active", "vocabulary_id": "b891512e-9516-4bf5-962a-7a289772a2a1"}, {"display_name": "who is doing what and where-3w-4w-5w", "id": "ec53893c-6dba-4656-978b-4a32289ea2eb", "name": "who is doing what and where-3w-4w-5w", "state": "active", "vocabulary_id": "b891512e-9516-4bf5-962a-7a289772a2a1"}], "relationships_as_subject": [], "relationships_as_object": [], "is_fresh": true, "update_status": "fresh", "x_resource_grouping": [], "resources": [{"alt_url": "https://data.humdata.org/dataset/f50bc211-d42f-4fcd-8291-3e4a57a0dfcf/resource/129a828a-9735-418e-ad41-691a6dac4144/download/", "cache_last_updated": null, "cache_url": null, "created": "2023-05-09T07:35:36.019511", "dataset_preview_enabled": false, "datastore_active": false, "description": "", "download_url": "https://data.humdata.org/dataset/f50bc211-d42f-4fcd-8291-3e4a57a0dfcf/resource/129a828a-9735-418e-ad41-691a6dac4144/download/afghanistan-3w-january-march-2023.xlsx", "format": "XLSX", "fs_check_info": "[{\"state\": \"processing\", \"message\": \"The processing of the file structure check has started\", \"timestamp\": \"2023-05-09T07:35:35.550193\"}, {\"state\": \"success\", \"message\": \"Hxl Proxy data received successfully\", \"timestamp\": \"2023-05-09T07:35:37.820231\", \"hxl_proxy_response\": {\"url_or_filename\": null, \"format\": \"XLSX\", \"sheets\": [{\"name\": \"MetaData\", \"is_hidden\": false, \"nrows\": 11, \"ncols\": 1, \"has_merged_cells\": false, \"is_hxlated\": false, \"header_hash\": \"8a9c0818e0622aadfcb2e59cfe5299b4\", \"hxl_header_hash\": null}, {\"name\": \"List_District\", \"is_hidden\": false, \"nrows\": 403, \"ncols\": 21, \"has_merged_cells\": false, \"is_hxlated\": true, \"header_hash\": \"30d419bf10484e12f5a01f983141414f\", \"hxl_header_hash\": \"13a225f52ee1aef7a638c73adb893a32\"}, {\"name\": \"Count_District\", \"is_hidden\": false, \"nrows\": 403, \"ncols\": 21, \"has_merged_cells\": false, \"is_hxlated\": true, \"header_hash\": \"30d419bf10484e12f5a01f983141414f\", \"hxl_header_hash\": \"13a225f52ee1aef7a638c73adb893a32\"}]}}]", "hash": "", "hdx_rel_url": "/dataset/f50bc211-d42f-4fcd-8291-3e4a57a0dfcf/resource/129a828a-9735-418e-ad41-691a6dac4144/download/afghanistan-3w-january-march-2023.xlsx", "id": "129a828a-9735-418e-ad41-691a6dac4144", "last_modified": "2023-05-09T07:35:35.641553", "metadata_modified": "2023-05-09T14:11:46.390076", "microdata": false, "mimetype": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "mimetype_inner": null, "name": "afghanistan-3w-january-march-2023.xlsx", "originalHash": "-988266717", "package_id": "f50bc211-d42f-4fcd-8291-3e4a57a0dfcf", "pii": "false", "pii_predict_score": 0.8562966605953982, "pii_report_flag": "FINDINGS", "pii_report_id": "/resources/129a828a-9735-418e-ad41-691a6dac4144/pii.2023-05-09T07-35-40.main.json", "pii_timestamp": "2023-05-09T07:36:15.845000", "position": 0, "resource_type": "file.upload", "size": 142558, "state": "active", "url": "https://data.humdata.org/dataset/f50bc211-d42f-4fcd-8291-3e4a57a0dfcf/resource/129a828a-9735-418e-ad41-691a6dac4144/download/afghanistan-3w-january-march-2023.xlsx", "url_type": "upload"}, {"alt_url": "https://data.humdata.org/dataset/f50bc211-d42f-4fcd-8291-3e4a57a0dfcf/resource/1d28eb8a-5585-4694-ba2f-766212a2f5ae/download/", "cache_last_updated": null, "cache_url": null, "created": "2023-05-04T06:04:44.805532", "dataset_preview_enabled": true, "datastore_active": false, "description": "", "download_url": "https://data.humdata.org/dataset/f50bc211-d42f-4fcd-8291-3e4a57a0dfcf/resource/1d28eb8a-5585-4694-ba2f-766212a2f5ae/download/afghanistan-3w-operational-presence-january-march-2023.csv", "format": "CSV", "hash": "", "hdx_rel_url": "/dataset/f50bc211-d42f-4fcd-8291-3e4a57a0dfcf/resource/1d28eb8a-5585-4694-ba2f-766212a2f5ae/download/afghanistan-3w-operational-presence-january-march-2023.csv", "id": "1d28eb8a-5585-4694-ba2f-766212a2f5ae", "last_modified": "2023-05-09T07:35:47.682796", "metadata_modified": "2023-06-05T10:39:33.579461", "microdata": false, "mimetype": "text/csv", "mimetype_inner": null, "name": "afghanistan-3w-operational-presence-january-march-2023.csv", "originalHash": -1590159593, "package_id": "f50bc211-d42f-4fcd-8291-3e4a57a0dfcf", "pii": "false", "pii_predict_score": 0.7961682088135019, "pii_report_flag": "FINDINGS", "pii_report_id": "/resources/1d28eb8a-5585-4694-ba2f-766212a2f5ae/pii.2023-05-09T07-35-51.main.json", "pii_timestamp": "2023-05-09T07:36:40.941000", "position": 1, "resource_type": "file.upload", "size": 1477495, "state": "active", "url": "https://data.humdata.org/dataset/f50bc211-d42f-4fcd-8291-3e4a57a0dfcf/resource/1d28eb8a-5585-4694-ba2f-766212a2f5ae/download/afghanistan-3w-operational-presence-january-march-2023.csv", "url_type": "upload"}, {"alt_url": "https://data.humdata.org/dataset/f50bc211-d42f-4fcd-8291-3e4a57a0dfcf/resource/f4b8a3d4-b952-4375-b9b8-926c78047c59/download/", "cache_last_updated": null, "cache_url": null, "created": "2023-05-04T06:04:54.297605", "dataset_preview_enabled": false, "datastore_active": false, "description": "", "download_url": "https://data.humdata.org/dataset/f50bc211-d42f-4fcd-8291-3e4a57a0dfcf/resource/f4b8a3d4-b952-4375-b9b8-926c78047c59/download/afghanistan-3w-operational-capacity-january-march-2023.csv", "format": "CSV", "hash": "", "hdx_rel_url": "/dataset/f50bc211-d42f-4fcd-8291-3e4a57a0dfcf/resource/f4b8a3d4-b952-4375-b9b8-926c78047c59/download/afghanistan-3w-operational-capacity-january-march-2023.csv", "id": "f4b8a3d4-b952-4375-b9b8-926c78047c59", "last_modified": "2023-05-04T06:04:54.071665", "metadata_modified": "2023-05-04T06:05:52.859718", "microdata": false, "mimetype": "text/csv", "mimetype_inner": null, "name": "afghanistan-3w-operational-capacity-january-march-2023.csv", "originalHash": "-988266717", "package_id": "f50bc211-d42f-4fcd-8291-3e4a57a0dfcf", "pii": "false", "pii_predict_score": 0.7829160250103557, "pii_report_flag": "FINDINGS", "pii_report_id": "/resources/f4b8a3d4-b952-4375-b9b8-926c78047c59/pii.2023-05-04T06-04-57.main.json", "pii_timestamp": "2023-05-04T06:05:52.383000", "position": 2, "resource_type": "file.upload", "size": 1302201, "state": "active", "url": "https://data.humdata.org/dataset/f50bc211-d42f-4fcd-8291-3e4a57a0dfcf/resource/f4b8a3d4-b952-4375-b9b8-926c78047c59/download/afghanistan-3w-operational-capacity-january-march-2023.csv", "url_type": "upload"}]} |
Oops, something went wrong.