-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
a first test to open the path to glory
- Loading branch information
Showing
7 changed files
with
161 additions
and
36 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,29 @@ | ||
name: Data Import Tests | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'data/**' | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
data-import-test: | ||
name: Data Import Tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
working-directory: data | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Data Import tests | ||
working-directory: data/test | ||
run: | | ||
pytest |
Empty file.
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,4 @@ | ||
[pytest] | ||
testpaths = test | ||
python_files = test_*.py | ||
python_functions = test_* |
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
Empty file.
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,25 @@ | ||
import json | ||
import os | ||
|
||
from data.indicator_coefficient_importer.indicator_coefficient_importer import load_indicator_config | ||
|
||
|
||
def test_load_indicator_config(pytest=None): | ||
# Test case 1: Test with valid JSON data | ||
os.environ['INDICATOR_COEFFICIENT_CONFIG'] = json.dumps({"test": {"file": "path/file.csv", "indicator_code": "AA"}}) | ||
expected_output = [{"name": "test", "file": "path/file.csv", "indicator_code": "AA"}] | ||
real_output = load_indicator_config() | ||
assert real_output == expected_output | ||
|
||
# Test case 2: Test with invalid JSON data | ||
os.environ['INDICATOR_COEFFICIENT_CONFIG'] = "invalid_json" | ||
try: | ||
load_indicator_config() | ||
except ValueError as e: | ||
assert str(e) == "Environment variable 'INDICATOR_COEFFICIENT_CONFIG' must be a valid JSON string." | ||
# Test case 3: Test with empty JSON data | ||
os.environ['INDICATOR_COEFFICIENT_CONFIG'] = "" | ||
try: | ||
load_indicator_config() | ||
except ValueError as e: | ||
assert str(e) == "Environment variable 'INDICATOR_COEFFICIENT_CONFIG' is missing or empty. Aborting." |