Move units to admin_fuzzy_dont #1085
GitHub Actions / Test Results
failed
Oct 16, 2024 in 0s
1 errors, 16 pass in 18m 55s
Annotations
Check failure on line 0 in tests.test_main.TestHAPIPipelines
github-actions / Test Results
test_humanitarian_needs[themes_to_run0] (tests.test_main.TestHAPIPipelines) with error
test-results.xml [took 16s]
Raw output
failed on setup with "TypeError: 'gender' is an invalid keyword argument for DBHumanitarianNeeds"
self = <tests.test_main.TestHAPIPipelines object at 0x7ff9b2516900>
configuration = {'hdx_prod_site': {'url': 'https://data.humdata.org'}, 'hdx_demo_site': {'url': 'https://demo.data-humdata-org.ahconu.... markets', 'format': 'csv'}, 'unused_adm1': ['CIV', 'KEN'], 'unused_adm2': ['DOM', 'RUS', 'UGA'], 'adm1_only': ['SLV']}
folder = 'tests/fixtures', themes_to_run = {'humanitarian_needs': None}
@pytest.fixture(scope="function")
def pipelines(self, configuration, folder, themes_to_run):
with ErrorsOnExit() as errors_on_exit:
with temp_dir(
"TestHAPIPipelines",
delete_on_success=True,
delete_on_failure=False,
) as temp_folder:
db_uri = "postgresql+psycopg://postgres:postgres@localhost:5432/hapitest"
logger.info(f"Connecting to database {db_uri}")
with Database(
db_uri=db_uri,
recreate_schema=True,
prepare_fn=prepare_hapi_views,
) as database:
session = database.get_session()
today = parse_date("2023-10-11")
Read.create_readers(
temp_folder,
join(folder, "input"),
temp_folder,
False,
True,
today=today,
)
logger.info("Initialising pipelines")
pipelines = Pipelines(
configuration,
session,
today,
themes_to_run=themes_to_run,
errors_on_exit=errors_on_exit,
use_live=False,
countries_to_run=configuration["HAPI_countries"],
)
logger.info("Running pipelines")
pipelines.run()
logger.info("Writing to database")
> pipelines.output()
tests/test_main.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/hapi/pipelines/app/pipelines.py:388: in output
self.output_humanitarian_needs()
src/hapi/pipelines/app/pipelines.py:266: in output_humanitarian_needs
humanitarian_needs.populate()
src/hapi/pipelines/database/humanitarian_needs.py:139: in populate
create_row("Population", "all")
src/hapi/pipelines/database/humanitarian_needs.py:120: in create_row
humanitarian_needs_row = DBHumanitarianNeeds(
<string>:4: in __init__
???
../../../.local/share/hatch/env/virtual/hapi-pipelines/zEFzVURN/hatch-test.py3.12/lib/python3.12/site-packages/sqlalchemy/orm/state.py:571: in _initialize_instance
with util.safe_reraise():
../../../.local/share/hatch/env/virtual/hapi-pipelines/zEFzVURN/hatch-test.py3.12/lib/python3.12/site-packages/sqlalchemy/util/langhelpers.py:146: in __exit__
raise exc_value.with_traceback(exc_tb)
../../../.local/share/hatch/env/virtual/hapi-pipelines/zEFzVURN/hatch-test.py3.12/lib/python3.12/site-packages/sqlalchemy/orm/state.py:569: in _initialize_instance
manager.original_init(*mixed[1:], **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <hapi_schema.db_humanitarian_needs.DBHumanitarianNeeds object at 0x7ff9b08f7170>
kwargs = {'admin2_ref': 5694, 'age_range': 'ALL', 'disabled_marker': 'all', 'gender': 'all', ...}
cls_ = <class 'hapi_schema.db_humanitarian_needs.DBHumanitarianNeeds'>
k = 'gender'
def _declarative_constructor(self: Any, **kwargs: Any) -> None:
"""A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and
values in ``kwargs``.
Only keys that are present as
attributes of the instance's class are allowed. These could be,
for example, any mapped columns or relationships.
"""
cls_ = type(self)
for k in kwargs:
if not hasattr(cls_, k):
> raise TypeError(
"%r is an invalid keyword argument for %s" % (k, cls_.__name__)
)
E TypeError: 'gender' is an invalid keyword argument for DBHumanitarianNeeds
../../../.local/share/hatch/env/virtual/hapi-pipelines/zEFzVURN/hatch-test.py3.12/lib/python3.12/site-packages/sqlalchemy/orm/decl_base.py:2177: TypeError
Loading