Skip to content

Commit

Permalink
Ajoute test pote dans la CI
Browse files Browse the repository at this point in the history
  • Loading branch information
clallemand committed Aug 7, 2024
1 parent 260cebb commit e2dd58a
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,6 @@ openfisca_erfs_fpr.json
.pytest_cache/

figures_directory

# test python
*.parquet
10 changes: 10 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ cache:
stages:
- docker
- test
- pote
- build_collection
- build_input_data
- diagnostics
Expand Down Expand Up @@ -133,6 +134,15 @@ diagnostics:
tags:
- openfisca

build_and_test_pote:
image: $CI_REGISTRY_IMAGE:latest
script:
- cp ./.gitlab-ci/pote_openfisca_survey_manager_config.ini ~/.config/openfisca-survey-manager/config.ini
- python tests/pote/create_fake_data.py -y 2022 -p /tests/pote/fake_data/raw/
- build-pote -y 2022 -c ~/.config/openfisca-survey-manager/
- pytest tests/pote/test_pote_survey_scenario
stage: pote

check-version-and-changelog:
stage: diagnostics
before_script:
Expand Down
15 changes: 15 additions & 0 deletions .gitlab-ci/pote_openfisca_survey_manager_config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Version pote du emplate du fichier config.ini de openfisca-survey-manager
# pour qu'il fonctionne avec openfisca-france-data


[collections]
collections_directory = /tests/pote/fake_data/output/data_collections
pote = /tests/pote/fake_data/output/data_collections/pote.json

[data]
raw_pote = /tests/pote/fake_data/raw/
output_directory = /tests/pote/fake_data/output/
tmp_directory = /tests/pote/fake_data/tmp/

[openfisca_france_data_pote]
errors_path = /tests/pote/fake_data/
2 changes: 0 additions & 2 deletions tests/pote/create_fake_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import os
import click

output_path = "/home/cgl/leximpact/openfisca-france-data/tests/pote/fake_data/raw/"

def create_fake_data(year = 2022, data_length = 100, output_path = output_path):
if not os.path.exists(output_path):
os.makedirs(output_path)
Expand Down
6 changes: 6 additions & 0 deletions tests/pote/test_pote_survey_scenario.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from openfisca_france_data.pote.survey_scenario import PoteSurveyScenario
from openfisca_survey_manager import default_config_files_directory

def test_pote_survey_scenario(period, config_file_directory=default_config_files_directory):
survey_scenario = PoteSurveyScenario(period = period, config_files_directory=config_file_directory)
assert survey_scenario.simulations['baseline'].compute_aggregate('irpp_economique', period) < 0, "La simulation ne s'est pas bien passée"

0 comments on commit e2dd58a

Please sign in to comment.