Skip to content

handle optional dependencies in tests#1038

Merged
sandorkertesz merged 2 commits into
developfrom
fix/optional_deps_tests
Jun 24, 2026
Merged

handle optional dependencies in tests#1038
sandorkertesz merged 2 commits into
developfrom
fix/optional_deps_tests

Conversation

@colonesej

Copy link
Copy Markdown
Contributor

This pull request improves test robustness and reliability by adding conditional skips to tests that depend on optional modules such as geopandas and pyodc. It introduces new flags in the testing utilities to check for the presence of these dependencies and updates relevant tests to skip execution gracefully if the required modules are missing, preventing unnecessary test failures.

Test robustness and conditional skipping:

  • Added NO_ODC and NO_GEOPANDAS flags in earthkit.data.utils.testing to check for the presence of pyodc and geopandas modules, respectively.
  • Updated ODB-related tests to skip at the module level if pyodc is not installed, using NO_ODC and pytest.skip. [1] [2] [3] [4] [5]
  • Updated GeoPandas-related tests to skip if geopandas is not installed, using NO_GEOPANDAS and pytest.mark.skipif or pytest.skip. [1] [2] [3] [4] [5] [6] [7]

These changes ensure that tests requiring optional dependencies do not fail unnecessarily, improving the reliability of the test suite across different environments.

Contributor Declaration

By opening this pull request, I affirm the following:

  • All authors agree to the Contributor License Agreement.
  • The code follows the project's coding standards.
  • I have performed self-review and added comments where needed.
  • I have added or updated tests to verify that my changes are effective and functional.
  • I have run all existing tests and confirmed they pass.

@colonesej
colonesej requested a review from sandorkertesz June 24, 2026 12:16
Comment thread src/earthkit/data/utils/testing.py Outdated
@codecov-commenter

codecov-commenter commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.69697% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.41%. Comparing base (ffe0e1f) to head (3bdda87).

Files with missing lines Patch % Lines
tests/high_level_object/test_hl_odb_core.py 50.00% 1 Missing and 1 partial ⚠️
tests/odb/test_odb_pandas.py 50.00% 1 Missing and 1 partial ⚠️
tests/odb/test_odb_url.py 50.00% 1 Missing and 1 partial ⚠️
tests/readers/test_geojson_reader.py 33.33% 1 Missing and 1 partial ⚠️
tests/readers/test_shapefile_reader.py 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1038      +/-   ##
===========================================
- Coverage    82.44%   82.41%   -0.04%     
===========================================
  Files          237      237              
  Lines        16698    16722      +24     
  Branches       808      813       +5     
===========================================
+ Hits         13767    13781      +14     
- Misses        2694     2699       +5     
- Partials       237      242       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@colonesej
colonesej force-pushed the fix/optional_deps_tests branch from bd93d52 to 90f6998 Compare June 24, 2026 15:03
Co-authored-by: Oisin-M <60450429+Oisin-M@users.noreply.github.com>
@sandorkertesz
sandorkertesz merged commit 8ee8bc4 into develop Jun 24, 2026
122 checks passed
@Oisin-M
Oisin-M deleted the fix/optional_deps_tests branch June 24, 2026 16:29
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.

4 participants