helpers icon indicating copy to clipboard operation
helpers copied to clipboard

Broken test Test_sync_gh_issue_labels1

Open gpsaggese opened this issue 7 months ago • 2 comments

This test seems to have broken

> pytest dev_scripts_helpers/github/test/test_sync_gh_issue_labels.py::Test_sync_gh_issue_labels1::test1

17:46:07 - INFO  hdbg.py init_logger:1018                               > cmd='/app/dev_scripts_helpers/github/dockerized_sync_gh_issue_labels.py --input_file /app/dev_scripts_helpers/github/test/outcomes/Test_sync_gh_issue_labels1.test1/input/test_gh_issues_labels.yml --owner test-owner --repo test-repo --token_env_var GITHUB_TEST_TOKEN --dry_run --backup --no_interactive'
Traceback (most recent call last):
  File "/app/dev_scripts_helpers/github/dockerized_sync_gh_issue_labels.py", line 265, in <module>
    _main(_parse())
  File "/app/dev_scripts_helpers/github/dockerized_sync_gh_issue_labels.py", line 190, in _main
    repo = client.get_repo(f"{args.owner}/{args.repo}")
  File "/usr/local/lib/python3.10/site-packages/github/MainClass.py", line 471, in get_repo
    headers, data = self.__requester.requestJsonAndCheck("GET", url)
  File "/usr/local/lib/python3.10/site-packages/github/Requester.py", line 624, in requestJsonAndCheck
    return self.__check(
  File "/usr/local/lib/python3.10/site-packages/github/Requester.py", line 792, in __check
    raise self.createException(status, responseHeaders, data)
github.GithubException.BadCredentialsException: 401 {"message": "Bad credentials", "documentation_url": "https://docs.github.com/rest", "status": "401"}

The underlying issue is that we still can't run tests on the server due to CmampTask10710

gpsaggese avatar May 22 '25 17:05 gpsaggese

I got stuck in a loop when I tried to solve the issue as mentioned in https://github.com/causify-ai/helpers/pull/649#discussion_r2083764786.

Mount Issue: The test_sync_gh_issue_labels.py fails because the bind source path is already mounted to another test Docker container (run_fast_tests), making it unavailable for the sibling container created by sync_gh_issue_labels.py.

Mocking Issue: When you resolve the mount issue by making the container a child container, the scope of the mocked object (github) becomes extinct, causing the test to fail due to the absence of proper mocking.

I was waiting for the fix to CmampTask10710 to see if I could run the test locally.

sandeepthalapanane avatar May 26 '25 17:05 sandeepthalapanane

Sg. Let's wait for CmampTask10710 fix (which is on me)

gpsaggese avatar Jun 02 '25 12:06 gpsaggese