Ejemplo n.º 1
0
def main(parser=None):
    if not parser:
        parser = argparse.ArgumentParser()
        parser = build_parser(parser)

        warnings.warn(
            "The 'openfisca-run-test' command has been deprecated in favor of 'openfisca test' since version 25.0, and will be removed in the future.",
            Warning)

    args = parser.parse_args()
    logging.basicConfig(
        level=logging.DEBUG if args.verbose else logging.WARNING,
        stream=sys.stdout)

    tax_benefit_system = build_tax_benefit_system(args.country_package,
                                                  args.extensions,
                                                  args.reforms)

    options = {
        'verbose': args.verbose,
        'name_filter': args.name_filter,
        'only_variables': args.only_variables,
        'ignore_variables': args.ignore_variables,
    }

    paths = [os.path.abspath(path) for path in args.path]
    tests_ok = run_tests(tax_benefit_system, paths, options)

    if not tests_ok:
        sys.exit(1)
Ejemplo n.º 2
0
 def load(self):
     tax_benefit_system = build_tax_benefit_system(
         self.options.get('country_package'),
         self.options.get('extensions'), self.options.get('reforms'))
     return create_app(tax_benefit_system, self.options.get('tracker_url'),
                       self.options.get('tracker_idsite'),
                       self.options.get('tracker_token'),
                       self.options.get('welcome_message'))
Ejemplo n.º 3
0
def client():
    tax_benefit_system = scripts.build_tax_benefit_system(
        TEST_COUNTRY_PACKAGE_NAME,
        extensions=None,
        reforms=TEST_REFORMS_PATHS,
    )

    return app.create_app(tax_benefit_system).test_client()
Ejemplo n.º 4
0
def get_tax_benefit_system(settings: config.Settings = Depends(
    config.get_settings)):
    global tax_benefit_system
    if tax_benefit_system is None:
        tax_benefit_system = build_tax_benefit_system(
            settings.country_package,
            None,  # settings.extension,
            None,  # settings.reform,
        )
    return tax_benefit_system
Ejemplo n.º 5
0
def main():
    parser = build_parser()
    args = parser.parse_args()
    paths = [os.path.abspath(path) for path in args.path]

    tax_benefit_system = build_tax_benefit_system(args.country_package,
                                                  args.extensions,
                                                  args.reforms)

    Migrator(tax_benefit_system).migrate(paths)
Ejemplo n.º 6
0
 def load(self):
     tax_benefit_system = build_tax_benefit_system(
         self.options.get('country_package'),
         self.options.get('extensions'),
         self.options.get('reforms')
         )
     return create_app(
         tax_benefit_system,
         self.options.get('tracker_url'),
         self.options.get('tracker_idsite'),
         self.options.get('tracker_token'),
         self.options.get('welcome_message')
         )
Ejemplo n.º 7
0
def main(parser):
    args = parser.parse_args()
    logging.basicConfig(level = logging.DEBUG if args.verbose else logging.WARNING, stream = sys.stdout)

    tax_benefit_system = build_tax_benefit_system(args.country_package, args.extensions, args.reforms)

    options = {
        'pdb': args.pdb,
        'verbose': args.verbose,
        'name_filter': args.name_filter,
        'only_variables': args.only_variables,
        'ignore_variables': args.ignore_variables,
        }

    paths = [os.path.abspath(path) for path in args.path]
    sys.exit(run_tests(tax_benefit_system, paths, options))
Ejemplo n.º 8
0
def main(parser):
    args = parser.parse_args()
    logging.basicConfig(
        level=logging.DEBUG if args.verbose else logging.WARNING,
        stream=sys.stdout)

    tax_benefit_system = build_tax_benefit_system(args.country_package,
                                                  args.extensions,
                                                  args.reforms)

    options = {
        'pdb': args.pdb,
        'verbose': args.verbose,
        'name_filter': args.name_filter,
        'only_variables': args.only_variables,
        'ignore_variables': args.ignore_variables,
    }

    paths = [os.path.abspath(path) for path in args.path]
    sys.exit(run_tests(tax_benefit_system, paths, options))
Ejemplo n.º 9
0
def main():
    parser = build_parser()
    args = parser.parse_args()
    logging.basicConfig(
        level=logging.DEBUG if args.verbose else logging.WARNING,
        stream=sys.stdout)

    tax_benefit_system = build_tax_benefit_system(args.country_package,
                                                  args.extensions,
                                                  args.reforms)

    options = {
        'verbose': args.verbose,
        'name_filter': args.name_filter,
    }

    paths = map(os.path.abspath, args.path)
    tests_ok = run_tests(tax_benefit_system, paths, options)

    if not tests_ok:
        sys.exit(1)
Ejemplo n.º 10
0
# -*- coding: utf-8 -*-
from openfisca_core.scripts import build_tax_benefit_system
from openfisca_core.simulations import Simulation
import openfisca_france
import requests

import copy
import utils

country_package = 'openfisca_france'

tax_benefit_system = build_tax_benefit_system(
    country_package_name=country_package, extensions=[], reforms=None)
allMonths = ['2018-08']
calculs = {
    'af': allMonths,
    'af_nbenf': allMonths,
    'af_taux_modulation': allMonths,
    'prestations_familiales_base_ressources': allMonths,
}

calculs = {
    'af': allMonths,
}

import experiment_af
import situations
situation = utils.merge(utils.prefix('7618153', situations.situation_7618153),
                        utils.prefix('6771069', situations.situation_6771069))

simulation_actuelle = Simulation(tax_benefit_system=tax_benefit_system,
Ejemplo n.º 11
0
# -*- coding: utf-8 -*-
import pkg_resources
from openfisca_web_api.app import create_app
from openfisca_core.scripts import build_tax_benefit_system

TEST_COUNTRY_PACKAGE_NAME = 'openfisca_country_template'
distribution = pkg_resources.get_distribution(TEST_COUNTRY_PACKAGE_NAME)
tax_benefit_system = build_tax_benefit_system(TEST_COUNTRY_PACKAGE_NAME,
                                              extensions=None,
                                              reforms=None)
subject = create_app(tax_benefit_system).test_client()
Ejemplo n.º 12
0
# -*- coding: utf-8 -*-
import pkg_resources
from openfisca_web_api.app import create_app
from openfisca_core.scripts import build_tax_benefit_system

TEST_COUNTRY_PACKAGE_NAME = 'openfisca_country_template'
distribution = pkg_resources.get_distribution(TEST_COUNTRY_PACKAGE_NAME)
tax_benefit_system = build_tax_benefit_system(TEST_COUNTRY_PACKAGE_NAME, extensions = None, reforms = None)
subject = create_app(tax_benefit_system).test_client()
Ejemplo n.º 13
0
from openfisca_core.scripts import build_tax_benefit_system
from openfisca_web_api.app import create_app

country_package = 'openfisca_france'
extensions = ['openfisca_france_local', 'openfisca_paris', 'openfisca_brestmetropole', 'openfisca_rennesmetropole']

tax_benefit_system = build_tax_benefit_system(
    country_package_name = country_package,
    extensions = extensions,
    reforms = ['openfisca_france_local.fsl_factory.fsl_reform', 'openfisca_france_local.epci_test_factory.epci_reform']
)

application = create_app(tax_benefit_system)
Ejemplo n.º 14
0
from openfisca_core.scripts import build_tax_benefit_system
from openfisca_web_api.app import create_app

country_package = 'openfisca_france'
extensions = ['openfisca_france_local', 'openfisca_paris', 'openfisca_brestmetropole', 'openfisca_rennesmetropole']

tax_benefit_system = build_tax_benefit_system(
    country_package_name = country_package,
    extensions = extensions,
    reforms = []
)

application = create_app(tax_benefit_system)
Ejemplo n.º 15
0
from openfisca_core.scripts import build_tax_benefit_system
from openfisca_web_api.app import create_app

country_package = 'openfisca_france'
extensions = ['openfisca_bacASable', 'openfisca_paris', 'openfisca_brestmetropole', 'openfisca_rennesmetropole']

tax_benefit_system = build_tax_benefit_system(
    country_package_name = country_package,
    extensions = extensions,
    reforms = ['openfisca_bacASable.simulation_reform.simulation_reform']
)

application = create_app(tax_benefit_system)