Skip to content

Translate API request tests to pytest#584

Open
YulianLC wants to merge 1 commit intoos-climate:mainfrom
arfima:contribute-api-tests-to-main
Open

Translate API request tests to pytest#584
YulianLC wants to merge 1 commit intoos-climate:mainfrom
arfima:contribute-api-tests-to-main

Conversation

@YulianLC
Copy link
Copy Markdown

This pull request migrates the API request tests (test_data_request.py and test_impact_request.py) from unittest to pytest.

It also moves test_example_portfolios from test_live_services.py into test_impact_request.py, where it fits better because it exercises the API request/response path rather than isolated kernel logic.

It adds test_available_sources to cover the get_available_sources endpoint.

conftest.py is updated to support this migration by adding clear_credentials fixture for tests that should use the public OSC bucket anonymously, and by improving live_data marker handling so live tests are skipped unless PHYSRISK_ENVIRONMENT matches the requested environment.

For now, this PR only covers the API request tests as a focused example of how we plan to migrate the test suite from unittest to pytest. A follow-up PR will extend this approach to the remaining tests.

Co-authored-by: Juan Román Roche jroman@arfimaconsulting.com
Co-authored-by: Martxel Aranzadi Olazabal maranzadi@arfima.com
Co-authored-by: Violeta Crespo Cobas vcrespo@arfima.com
Co-authored-by: Jonathan Yanez Vargas jyanez@arfima.com
Co-authored-by: Arfima Dev dev@arfima.com
Co-authored-by: Virginia Morales vmorales@arfima.com
Co-authored-by: Víctor de Luna vdeluna@arfima.com
Co-authored-by: Xavier Barrachina Civera xbarrachina@arfima.com
Signed-off-by: Yulian Lyubomirov Cenov ycenov@arfima.com

-Add live_data pytest marker
-Add clear_credentials fixture to conftest
-Improve live_data marker validation and environment matching
-Move test_example_portfolios from kernel tests to api tests

Co-authored-by: Arfima Dev <dev@arfima.com>

Signed-off-by: Yulian Lyubomirov Cenov <ycenov@arfima.com>
@YulianLC YulianLC requested a review from joemoorhouse as a code owner April 29, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant