Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Fix: GitHub Runner Unit Tests Failed #25

Open
ca20110820 opened this issue Jun 12, 2024 · 0 comments
Open

Fix: GitHub Runner Unit Tests Failed #25

ca20110820 opened this issue Jun 12, 2024 · 0 comments

Comments

@ca20110820
Copy link

ca20110820 commented Jun 12, 2024

In the recent GitHub Runner Automated Unit Test Results, we can see failures in the following test methods:

  1. test_delete_video_from_user_data()
  2. test_delete_video_from_user_data_video_not_exist()
  3. test_audio_file_exists_in_audio_file_directory

I think the reason why (1) & (2) failed in GH runners is because utils.delete_video_from_userdata() opens the userdata.json file with pathlib.Path.open.

Proposed Solutions

(1) & (2)

Use mocker.patch("app.utils.Path.open") instead of mocker.patch("app.utils.open") in the test methods.

(3)

def test_audio_file_exists_in_audio_file_directory():
    file_path = (utils.APP_DIR / 'static' / 'audio' / 'success.mp3').resolve()
    file_path = str(file_path)
    assert os.path.exists(file_path)

Updates

(3) may be simplified as:

def test_audio_file_exists_in_audio_file_directory():
    assert (utils.APP_DIR / 'static' / 'audio' / 'success.mp3').resolve().exists()
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant