Skip to content

fix(tests): stub geo2r metadata in autoscan no-matrix test - #218

Open
marcbal77 wants to merge 1 commit into
bio-learn:masterfrom
marcbal77:fix/autoscan-test-geo2r-captcha
Open

marcbal77 wants to merge 1 commit into
bio-learn:masterfrom
marcbal77:fix/autoscan-test-geo2r-captcha

Conversation

@marcbal77

Copy link
Copy Markdown
Member

What

test_series_has_no_matrix_data_error fails on every PR right now, including #216. NCBI's geo2r backend (/geo/geo2r/backend/?type=samples...) now returns a Google reCAPTCHA page with status 200 to scripted requests, so response.json() raises JSONDecodeError before the test gets to the matrix check it is actually about.

How

  • The test stubs AutoScanGeoMatrixParser._create_metadata, so it still downloads the real GSE121633 matrix and asserts NoMatrixDataError, without depending on geo2r.
  • _create_metadata calls raise_for_status() and turns a non-JSON body into a ValueError that names the URL and says NCBI may be blocking automated requests. Before, users got a bare Expecting value: line 1 column 1.
  • New test test_metadata_query_non_json_response_error covers that error.

Heads up

This fixes CI, not the loader. Real AutoScanGeoMatrixParser loads of the ~2,165 entries in geo_autoscan_library.yaml will fail while geo2r keeps serving the CAPTCHA; they now fail with a readable message. A proper fix would read metadata from the series matrix header instead of geo2r, and belongs in its own PR.

Tests

make check-format clean. make test: 202 passed, 5 skipped, 0 failed.

geo2r now returns a CAPTCHA page to scripted requests, which broke CI on
master. The test stubs the metadata call, and _create_metadata raises a
clear error when the response is not JSON.
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