AlexsLemonade / AlexsLemonade/refinebio

Our tests break if GEO is down

Open
#2,471 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

nice to have
Dominant language
Python
Stars
135
Forks
21
PR merge metrics
No merged PRs in 30d

Description

Context

I'm trying to get my tests to pass on GitHub Actions, and I think I fixed the last bug but now GEO is down.

Problem or idea

If GEO is down our tests fail, and they fail with a cryptic error message:

Traceback (most recent call last):
  File "/home/user/data_refinery_foreman/surveyor/external_source.py", line 168, in survey
    experiment, samples = self.discover_experiment_and_samples()
  File "/home/user/data_refinery_foreman/surveyor/geo.py", line 498, in discover_experiment_and_samples
    experiment, samples = self.create_experiment_and_samples_from_api(experiment_accession_code)
  File "/home/user/data_refinery_foreman/surveyor/geo.py", line 316, in create_experiment_and_samples_from_api
    self.set_platform_properties(sample_object, sample.metadata, gse)
  File "/home/user/data_refinery_foreman/surveyor/geo.py", line 78, in set_platform_properties
    external_accession, destdir=self.get_temp_path(), how="brief", silent=True
  File "/usr/local/lib/python3.5/dist-packages/GEOparse/GEOparse.py", line 86, in get_GEO
    return parse_GPL(filepath)
  File "/usr/local/lib/python3.5/dist-packages/GEOparse/GEOparse.py", line 411, in parse_GPL
    with utils.smart_open(filepath) as soft:
  File "/usr/lib/python3.5/contextlib.py", line 59, in __enter__
    return next(self.gen)
  File "/usr/local/lib/python3.5/dist-packages/GEOparse/utils.py", line 156, in smart_open
    fh = fopen(filepath, mode, errors="ignore")
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/2/GPL570.txt'
Solution or next step

If possible, we should find a way to mock out those network requests.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the GEO access paths in surveyor/external_source.py and surveyor/geo.py, then locate the tests that exercise them and run the relevant test suite. Isolate those tests from GEO network availability by mocking the requests, and confirm they pass when the external service is unavailable.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.