MIT-AI-Accelerator / MIT-AI-Accelerator/c3po-model-server

Adjust Mock Setup in weak learner upload

Open
#23 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1
Forks
1
Avg merge
2d 14h
Merged PRs (30d)
2

Description

While the current implementation works, it does risk erroring out if the underlying upload_file_to_minio implementation changes. Recommend adjusting to follow the mock pattern in the remainder of the same module. Specifically, adjust the following lines in test_upload_bertopic_embedding_pretrained_weak_learner_object_post_valid_request to directly patch the upload call:

    # Dump the object to the file object
    file_obj = io.BytesIO()
    pickle.dump(weak_learner_model_obj, file_obj)
    file_obj.seek(0)

    # Upload the file to the BERTopic Embedding Pretrained Model object
    response2 = client.post(
        f"/aimodels/bertopic/bertopic-embedding-pretrained/{embedding_pretrained_id}/upload/", files={"new_file": file_obj})

    os.remove(test_file)

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 in the test containing test_upload_bertopic_embedding_pretrained_weak_learner_object_post_valid_request and compare its upload mocking with the other tests in the same module. Update the test to patch the upload call directly, then run the relevant test to confirm the request still succeeds and the temporary file cleanup remains covered.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.