Open JerrySentry opened 2 weeks ago
This PR includes changes to shared
. Please review them here: https://github.com/codecov/shared/compare/b9e83b2c2f072749bae36c18b80d384b8cc50d94...fbcbf6a82e18bf0daf17c61483350330e5bd2fa1
Tests completed | Failed | Passed | Skipped |
---|---|---|---|
1786 | 8 | 1778 | 0 |
tasks.tests.unit.test_commit_update.TestCommitUpdate test_update_commit
Stack Traces | 0.101s run time
> > ``` > self = <worker.tasks.tests.unit.test_commit_update.TestCommitUpdate object at 0x7f27757f00b0> > mocker = <pytest_mock.plugin.MockFixture object at 0x7f277234fcb0> > mock_configuration = <shared.config.ConfigHelper object at 0x7f27726588c0> > dbsession = <sqlalchemy.orm.session.Session object at 0x7f27722b6060> > codecov_vcr = <vcr.cassette.Cassette object at 0x7f277273ff50> > mock_redis = <MagicMock name='_get_redis_instance_from_url()' id='139807399713088'> > celery_app = <Celery celery.tests at 0x7f277273d010> > > def test_update_commit( > self, > mocker, > mock_configuration, > dbsession, > codecov_vcr, > mock_redis, > celery_app, > ): > mocker.patch.object(CommitUpdateTask, "app", celery_app) > > commit = CommitFactory.create( > message="", > commitid="a2d3e3c30547a000f026daa47610bb3f7b63aece", > repository__owner__unencrypted_oauth_token="ghp_test3c8iyfspq6h4s9ugpmq19qp7826rv20o", > repository__owner__username="test-acc9", > repository__owner__service="github", > repository__owner__service_id="104562106", > repository__name="test_example", > ) > dbsession.add(commit) > dbsession.flush() > > > result = CommitUpdateTask().run_impl(dbsession, commit.repoid, commit.commitid) > > .../tests/unit/test_commit_update.py:38: > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > tasks/commit_update.py:44: in run_impl > was_updated = async_to_sync(possibly_update_commit_from_provider_info)( > .../local/lib/python3.12....../site-packages/asgiref/sync.py:277: in __call__ > return call_result.result() > .../local/lib/python3.12....../concurrent/futures/_base.py:449: in result > return self.__get_result() > .../local/lib/python3.12....../concurrent/futures/_base.py:401: in __get_result > raise self._exception > .../local/lib/python3.12....../site-packages/asgiref/sync.py:353: in main_wrap > result = await self.awaitable(*args, **kwargs) > services/repository.py:212: in possibly_update_commit_from_provider_info > await update_commit_from_provider_info(repository_service, commit) > .../local/lib/python3.12.../site-packages/sentry_sdk/tracing_utils.py:645: in func_with_tracing > return await func(*args, **kwargs) > services/repository.py:273: in update_commit_from_provider_info > commit_updates = await repository_service.get_pull_request( > .../local/lib/python3.12.../shared/torngit/github.py:2040: in get_pull_request > res = await self.api(client, "post", url, body=query, token=token) > .../local/lib/python3.12.../shared/torngit/github.py:714: in api > response = await self.make_http_call(*args, token_to_use=token_to_use, **kwargs) > .../local/lib/python3.12.../shared/torngit/github.py:889: in make_http_call > res = await client.request(method, url, **kwargs) > .../local/lib/python3.12.../site-packages/httpx/_client.py:1533: in request > return await self.send(request, auth=auth, follow_redirects=follow_redirects) > .../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:124: in _async_vcr_send > vcr_request, response = _shared_vcr_send(cassette, real_send, *args, **kwargs) > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > > cassette = <vcr.cassette.Cassette object at 0x7f277273ff50> > real_send = <function AsyncClient.send at 0x7f277e56da80> > args = (<httpx.AsyncClient object at 0x7f277279cd40>, <Request('POST', 'https://api.github.com/graphql')>) > kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7f277e7ad5e0>, 'follow_redirects': False} > real_request = <Request('POST', 'https://api.github.com/graphql')> > vcr_request = <Request (POST) https://api.github.com/graphql> > > def _shared_vcr_send(cassette, real_send, *args, **kwargs): > real_request = args[1] > > vcr_request = _make_vcr_request(real_request, **kwargs) > > if cassette.can_play_response_for(vcr_request): > return vcr_request, _play_responses(cassette, real_request, vcr_request, args[0], kwargs) > > if cassette.write_protected and cassette.filter_request(vcr_request): > > raise CannotOverwriteExistingCassetteException(cassette=cassette, failed_request=vcr_request) > E vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('.../test_commit_update/TestCommitUpdate/test_update_commit.yaml') in your current record mode ('once'). > E No match for the request (<Request (POST) https://api.github.com/graphql>) was found. > E Found 4 similar requests with 2 different matcher(s) : > E > E 1 - (<Request (GET) https://api.github..../test_example/commits/a2d3e3c30547a000f026daa47610bb3f7b63aece>). > E Matchers succeeded : ['scheme', 'host', 'port'] > E Matchers failed : > E method - assertion failure : > E POST != GET > E path - assertion failure : > E /graphql != .../test_example/commits/a2d3e3c30547a000f026daa47610bb3f7b63aece > E > E 2 - (<Request (GET) https://api.github..../test_example/pulls/1>). > E Matchers succeeded : ['scheme', 'host', 'port'] > E Matchers failed : > E method - assertion failure : > E POST != GET > E path - assertion failure : > E /graphql != .../test_example/pulls/1 > E > E 3 - (<Request (GET) https://api.github..../test_example/pulls/1/commits?per_page=250>). > E Matchers succeeded : ['scheme', 'host', 'port'] > E Matchers failed : > E method - assertion failure : > E POST != GET > E path - assertion failure : > E /graphql != .../test_example/pulls/1/commits > E > E 4 - (<Request (GET) https://api.github..../test-acc9/test_example/commits?sha=a2d3e3c30547a000f026daa47610bb3f7b63aece>). > E Matchers succeeded : ['scheme', 'host', 'port'] > E Matchers failed : > E method - assertion failure : > E POST != GET > E path - assertion failure : > E /graphql != .../test-acc9/test_example/commits > > .../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:79: CannotOverwriteExistingCassetteException > ```tasks.tests.integration.test_notify_task.TestNotifyTask test_simple_call_status_and_notifiers
Stack Traces | 0.118s run time
> > ``` > self = <worker.tasks.tests.integration.test_notify_task.TestNotifyTask object at 0x7f27758beb70> > mock_post_request = <MagicMock name='post' id='139807406992336'> > dbsession = <sqlalchemy.orm.session.Session object at 0x7f277309a540> > mocker = <pytest_mock.plugin.MockFixture object at 0x7f2773106060> > codecov_vcr = <vcr.cassette.Cassette object at 0x7f2772f93710> > mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f2772d3f650> > mock_configuration = <shared.config.ConfigHelper object at 0x7f2772d499d0> > is_not_first_pull = None > > @patch("requests.post") > def test_simple_call_status_and_notifiers( > self, > mock_post_request, > dbsession, > mocker, > codecov_vcr, > mock_storage, > mock_configuration, > is_not_first_pull, > ): > mock_post_request.return_value.status_code = 200 > mock_configuration.params["setup"]["codecov_dashboard_url"] = ( > "https://myexamplewebsite.io" > ) > mocker.patch.object(NotifyTask, "app") > repository = RepositoryFactory.create( > owner__unencrypted_oauth_token=sample_token, > owner__username="joseph-sentry", > owner__service="github", > owner__service_id="136376984", > owner__email="joseph.sawaya@sentry.io", > name="codecov-demo", > image_token="abcdefghij", > ) > dbsession.add(repository) > dbsession.flush() > head_commitid = "5601846871b8142ab0df1e0b8774756c658bcc7d" > master_sha = "5b174c2b40d501a70c479e91025d5109b1ad5c1b" > master_commit = CommitFactory.create( > message="", > pullid=None, > branch="main", > commitid=master_sha, > repository=repository, > author=repository.owner, > ) > # create another pull so that we don't trigger the 1st time comment message > dbsession.add(PullFactory.create(repository=repository, pullid=8)) > commit = CommitFactory.create( > message="", > pullid=9, > branch="test", > commitid=head_commitid, > parent_commit_id=master_commit.commitid, > repository=repository, > author=repository.owner, > ) > dbsession.add(commit) > dbsession.add(master_commit) > dbsession.flush() > task = NotifyTask() > with open(".../tests/samples/sample_chunks_1.txt") as f: > content = f.read().encode() > archive_hash = ArchiveService.get_archive_hash(commit.repository) > chunks_url = f"v4/repos/{archive_hash}/commits/{commit.commitid}/chunks.txt" > mock_storage.write_file("archive", chunks_url, content) > master_chunks_url = ( > f"v4/repos/{archive_hash}/commits/{master_commit.commitid}/chunks.txt" > ) > mock_storage.write_file("archive", master_chunks_url, content) > > result = task.run_impl_within_lock( > dbsession, > repoid=commit.repoid, > commitid=commit.commitid, > current_yaml={ > "comment": { > "layout": "reach, diff, flags, files, footer", > "behavior": "default", > "require_changes": [ > CoverageCommentRequiredChanges.no_requirements.value > ], > "require_base": False, > "require_head": True, > }, > "coverage": { > "status": {"project": True, "patch": True, "changes": True}, > "notify": { > "webhook": { > "default": { > "url": "https://6da6786648c8a8e5b8b09bc6562af8b4.m.pipedream.net" > } > }, > "slack": { > "default": { > "url": "https://hooks.slack..../testkylhk/test01hg7/testohfnij1e83uy4xt8sxml" > } > }, > }, > }, > }, > ) > > .../tests/integration/test_notify_task.py:861: > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > tasks/notify.py:334: in run_impl_within_lock > enriched_pull = async_to_sync( > .../local/lib/python3.12....../site-packages/asgiref/sync.py:277: in __call__ > return call_result.result() > .../local/lib/python3.12....../concurrent/futures/_base.py:449: in result > return self.__get_result() > .../local/lib/python3.12....../concurrent/futures/_base.py:401: in __get_result > raise self._exception > .../local/lib/python3.12....../site-packages/asgiref/sync.py:353: in main_wrap > result = await self.awaitable(*args, **kwargs) > .../local/lib/python3.12....../site-packages/sentry_sdk/tracing_utils.py:645: in func_with_tracing > return await func(*args, **kwargs) > services/repository.py:480: in fetch_and_update_pull_request_information_from_commit > enriched_pull = await fetch_and_update_pull_request_information( > .../local/lib/python3.12....../site-packages/sentry_sdk/tracing_utils.py:645: in func_with_tracing > return await func(*args, **kwargs) > services/repository.py:536: in fetch_and_update_pull_request_information > pull_information = await repository_service.get_pull_request(pullid=pullid) > .../local/lib/python3.12.../shared/torngit/github.py:2040: in get_pull_request > res = await self.api(client, "post", url, body=query, token=token) > .../local/lib/python3.12.../shared/torngit/github.py:714: in api > response = await self.make_http_call(*args, token_to_use=token_to_use, **kwargs) > .../local/lib/python3.12.../shared/torngit/github.py:889: in make_http_call > res = await client.request(method, url, **kwargs) > .../local/lib/python3.12.../site-packages/httpx/_client.py:1533: in request > return await self.send(request, auth=auth, follow_redirects=follow_redirects) > .../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:124: in _async_vcr_send > vcr_request, response = _shared_vcr_send(cassette, real_send, *args, **kwargs) > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > > cassette = <vcr.cassette.Cassette object at 0x7f2772f93710> > real_send = <function AsyncClient.send at 0x7f277e56da80> > args = (<httpx.AsyncClient object at 0x7f2772eced50>, <Request('POST', 'https://api.github.com/graphql')>) > kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7f277e7ad5e0>, 'follow_redirects': False} > real_request = <Request('POST', 'https://api.github.com/graphql')> > vcr_request = <Request (POST) https://api.github.com/graphql> > > def _shared_vcr_send(cassette, real_send, *args, **kwargs): > real_request = args[1] > > vcr_request = _make_vcr_request(real_request, **kwargs) > > if cassette.can_play_response_for(vcr_request): > return vcr_request, _play_responses(cassette, real_request, vcr_request, args[0], kwargs) > > if cassette.write_protected and cassette.filter_request(vcr_request): > > raise CannotOverwriteExistingCassetteException(cassette=cassette, failed_request=vcr_request) > E vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('.../test_notify_task/TestNotifyTask/test_simple_call_status_and_notifiers.yaml') in your current record mode ('once'). > E No match for the request (<Request (POST) https://api.github.com/graphql>) was found. > E Found 3 similar requests with 1 different matcher(s) : > E > E 1 - (<Request (POST) https://api.github..../issues/1/comments>). > E Matchers succeeded : ['method', 'scheme', 'host', 'port'] > E Matchers failed : > E path - assertion failure : > E /graphql != .../issues/1/comments > E > E 2 - (<Request (POST) https://api.github..../codecov-demo/statuses/5601846871b8142ab0df1e0b8774756c658bcc7d>). > E Matchers succeeded : ['method', 'scheme', 'host', 'port'] > E Matchers failed : > E path - assertion failure : > E /graphql != .../codecov-demo/statuses/5601846871b8142ab0df1e0b8774756c658bcc7d > E > E 3 - (<Request (POST) https://api.github..../issues/9/comments>). > E Matchers succeeded : ['method', 'scheme', 'host', 'port'] > E Matchers failed : > E path - assertion failure : > E /graphql != .../issues/9/comments > > .../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:79: CannotOverwriteExistingCassetteException > ```
To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard
All modified and coverable lines are covered by tests :white_check_mark:
@@ Coverage Diff @@
## main #781 +/- ##
==========================================
- Coverage 98.03% 97.69% -0.34%
==========================================
Files 438 438
Lines 36470 36470
==========================================
- Hits 35752 35631 -121
- Misses 718 839 +121
Flag | Coverage Δ | |
---|---|---|
integration | 97.69% <ø> (-0.34%) |
:arrow_down: |
unit | 97.69% <ø> (-0.34%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
Components | Coverage Δ | |
---|---|---|
NonTestCode | 95.64% <ø> (-0.26%) |
:arrow_down: |
OutsideTasks | 97.95% <ø> (-0.06%) |
:arrow_down: |
Tests completed | Failed | Passed | Skipped |
---|---|---|---|
1786 | 8 | 1778 | 0 |
tasks.tests.unit.test_commit_update.TestCommitUpdate test_update_commit
Stack Traces | 0.101s run time
> > ``` > self = <worker.tasks.tests.unit.test_commit_update.TestCommitUpdate object at 0x7f27757f00b0> > mocker = <pytest_mock.plugin.MockFixture object at 0x7f277234fcb0> > mock_configuration = <shared.config.ConfigHelper object at 0x7f27726588c0> > dbsession = <sqlalchemy.orm.session.Session object at 0x7f27722b6060> > codecov_vcr = <vcr.cassette.Cassette object at 0x7f277273ff50> > mock_redis = <MagicMock name='_get_redis_instance_from_url()' id='139807399713088'> > celery_app = <Celery celery.tests at 0x7f277273d010> > > def test_update_commit( > self, > mocker, > mock_configuration, > dbsession, > codecov_vcr, > mock_redis, > celery_app, > ): > mocker.patch.object(CommitUpdateTask, "app", celery_app) > > commit = CommitFactory.create( > message="", > commitid="a2d3e3c30547a000f026daa47610bb3f7b63aece", > repository__owner__unencrypted_oauth_token="ghp_test3c8iyfspq6h4s9ugpmq19qp7826rv20o", > repository__owner__username="test-acc9", > repository__owner__service="github", > repository__owner__service_id="104562106", > repository__name="test_example", > ) > dbsession.add(commit) > dbsession.flush() > > > result = CommitUpdateTask().run_impl(dbsession, commit.repoid, commit.commitid) > > .../tests/unit/test_commit_update.py:38: > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > tasks/commit_update.py:44: in run_impl > was_updated = async_to_sync(possibly_update_commit_from_provider_info)( > .../local/lib/python3.12....../site-packages/asgiref/sync.py:277: in __call__ > return call_result.result() > .../local/lib/python3.12....../concurrent/futures/_base.py:449: in result > return self.__get_result() > .../local/lib/python3.12....../concurrent/futures/_base.py:401: in __get_result > raise self._exception > .../local/lib/python3.12....../site-packages/asgiref/sync.py:353: in main_wrap > result = await self.awaitable(*args, **kwargs) > services/repository.py:212: in possibly_update_commit_from_provider_info > await update_commit_from_provider_info(repository_service, commit) > .../local/lib/python3.12.../site-packages/sentry_sdk/tracing_utils.py:645: in func_with_tracing > return await func(*args, **kwargs) > services/repository.py:273: in update_commit_from_provider_info > commit_updates = await repository_service.get_pull_request( > .../local/lib/python3.12.../shared/torngit/github.py:2040: in get_pull_request > res = await self.api(client, "post", url, body=query, token=token) > .../local/lib/python3.12.../shared/torngit/github.py:714: in api > response = await self.make_http_call(*args, token_to_use=token_to_use, **kwargs) > .../local/lib/python3.12.../shared/torngit/github.py:889: in make_http_call > res = await client.request(method, url, **kwargs) > .../local/lib/python3.12.../site-packages/httpx/_client.py:1533: in request > return await self.send(request, auth=auth, follow_redirects=follow_redirects) > .../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:124: in _async_vcr_send > vcr_request, response = _shared_vcr_send(cassette, real_send, *args, **kwargs) > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > > cassette = <vcr.cassette.Cassette object at 0x7f277273ff50> > real_send = <function AsyncClient.send at 0x7f277e56da80> > args = (<httpx.AsyncClient object at 0x7f277279cd40>, <Request('POST', 'https://api.github.com/graphql')>) > kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7f277e7ad5e0>, 'follow_redirects': False} > real_request = <Request('POST', 'https://api.github.com/graphql')> > vcr_request = <Request (POST) https://api.github.com/graphql> > > def _shared_vcr_send(cassette, real_send, *args, **kwargs): > real_request = args[1] > > vcr_request = _make_vcr_request(real_request, **kwargs) > > if cassette.can_play_response_for(vcr_request): > return vcr_request, _play_responses(cassette, real_request, vcr_request, args[0], kwargs) > > if cassette.write_protected and cassette.filter_request(vcr_request): > > raise CannotOverwriteExistingCassetteException(cassette=cassette, failed_request=vcr_request) > E vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('.../test_commit_update/TestCommitUpdate/test_update_commit.yaml') in your current record mode ('once'). > E No match for the request (<Request (POST) https://api.github.com/graphql>) was found. > E Found 4 similar requests with 2 different matcher(s) : > E > E 1 - (<Request (GET) https://api.github..../test_example/commits/a2d3e3c30547a000f026daa47610bb3f7b63aece>). > E Matchers succeeded : ['scheme', 'host', 'port'] > E Matchers failed : > E method - assertion failure : > E POST != GET > E path - assertion failure : > E /graphql != .../test_example/commits/a2d3e3c30547a000f026daa47610bb3f7b63aece > E > E 2 - (<Request (GET) https://api.github..../test_example/pulls/1>). > E Matchers succeeded : ['scheme', 'host', 'port'] > E Matchers failed : > E method - assertion failure : > E POST != GET > E path - assertion failure : > E /graphql != .../test_example/pulls/1 > E > E 3 - (<Request (GET) https://api.github..../test_example/pulls/1/commits?per_page=250>). > E Matchers succeeded : ['scheme', 'host', 'port'] > E Matchers failed : > E method - assertion failure : > E POST != GET > E path - assertion failure : > E /graphql != .../test_example/pulls/1/commits > E > E 4 - (<Request (GET) https://api.github..../test-acc9/test_example/commits?sha=a2d3e3c30547a000f026daa47610bb3f7b63aece>). > E Matchers succeeded : ['scheme', 'host', 'port'] > E Matchers failed : > E method - assertion failure : > E POST != GET > E path - assertion failure : > E /graphql != .../test-acc9/test_example/commits > > .../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:79: CannotOverwriteExistingCassetteException > ```tasks.tests.integration.test_notify_task.TestNotifyTask test_simple_call_status_and_notifiers
Stack Traces | 0.118s run time
> > ``` > self = <worker.tasks.tests.integration.test_notify_task.TestNotifyTask object at 0x7f27758beb70> > mock_post_request = <MagicMock name='post' id='139807406992336'> > dbsession = <sqlalchemy.orm.session.Session object at 0x7f277309a540> > mocker = <pytest_mock.plugin.MockFixture object at 0x7f2773106060> > codecov_vcr = <vcr.cassette.Cassette object at 0x7f2772f93710> > mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f2772d3f650> > mock_configuration = <shared.config.ConfigHelper object at 0x7f2772d499d0> > is_not_first_pull = None > > @patch("requests.post") > def test_simple_call_status_and_notifiers( > self, > mock_post_request, > dbsession, > mocker, > codecov_vcr, > mock_storage, > mock_configuration, > is_not_first_pull, > ): > mock_post_request.return_value.status_code = 200 > mock_configuration.params["setup"]["codecov_dashboard_url"] = ( > "https://myexamplewebsite.io" > ) > mocker.patch.object(NotifyTask, "app") > repository = RepositoryFactory.create( > owner__unencrypted_oauth_token=sample_token, > owner__username="joseph-sentry", > owner__service="github", > owner__service_id="136376984", > owner__email="joseph.sawaya@sentry.io", > name="codecov-demo", > image_token="abcdefghij", > ) > dbsession.add(repository) > dbsession.flush() > head_commitid = "5601846871b8142ab0df1e0b8774756c658bcc7d" > master_sha = "5b174c2b40d501a70c479e91025d5109b1ad5c1b" > master_commit = CommitFactory.create( > message="", > pullid=None, > branch="main", > commitid=master_sha, > repository=repository, > author=repository.owner, > ) > # create another pull so that we don't trigger the 1st time comment message > dbsession.add(PullFactory.create(repository=repository, pullid=8)) > commit = CommitFactory.create( > message="", > pullid=9, > branch="test", > commitid=head_commitid, > parent_commit_id=master_commit.commitid, > repository=repository, > author=repository.owner, > ) > dbsession.add(commit) > dbsession.add(master_commit) > dbsession.flush() > task = NotifyTask() > with open(".../tests/samples/sample_chunks_1.txt") as f: > content = f.read().encode() > archive_hash = ArchiveService.get_archive_hash(commit.repository) > chunks_url = f"v4/repos/{archive_hash}/commits/{commit.commitid}/chunks.txt" > mock_storage.write_file("archive", chunks_url, content) > master_chunks_url = ( > f"v4/repos/{archive_hash}/commits/{master_commit.commitid}/chunks.txt" > ) > mock_storage.write_file("archive", master_chunks_url, content) > > result = task.run_impl_within_lock( > dbsession, > repoid=commit.repoid, > commitid=commit.commitid, > current_yaml={ > "comment": { > "layout": "reach, diff, flags, files, footer", > "behavior": "default", > "require_changes": [ > CoverageCommentRequiredChanges.no_requirements.value > ], > "require_base": False, > "require_head": True, > }, > "coverage": { > "status": {"project": True, "patch": True, "changes": True}, > "notify": { > "webhook": { > "default": { > "url": "https://6da6786648c8a8e5b8b09bc6562af8b4.m.pipedream.net" > } > }, > "slack": { > "default": { > "url": "https://hooks.slack..../testkylhk/test01hg7/testohfnij1e83uy4xt8sxml" > } > }, > }, > }, > }, > ) > > .../tests/integration/test_notify_task.py:861: > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > tasks/notify.py:334: in run_impl_within_lock > enriched_pull = async_to_sync( > .../local/lib/python3.12....../site-packages/asgiref/sync.py:277: in __call__ > return call_result.result() > .../local/lib/python3.12....../concurrent/futures/_base.py:449: in result > return self.__get_result() > .../local/lib/python3.12....../concurrent/futures/_base.py:401: in __get_result > raise self._exception > .../local/lib/python3.12....../site-packages/asgiref/sync.py:353: in main_wrap > result = await self.awaitable(*args, **kwargs) > .../local/lib/python3.12....../site-packages/sentry_sdk/tracing_utils.py:645: in func_with_tracing > return await func(*args, **kwargs) > services/repository.py:480: in fetch_and_update_pull_request_information_from_commit > enriched_pull = await fetch_and_update_pull_request_information( > .../local/lib/python3.12....../site-packages/sentry_sdk/tracing_utils.py:645: in func_with_tracing > return await func(*args, **kwargs) > services/repository.py:536: in fetch_and_update_pull_request_information > pull_information = await repository_service.get_pull_request(pullid=pullid) > .../local/lib/python3.12.../shared/torngit/github.py:2040: in get_pull_request > res = await self.api(client, "post", url, body=query, token=token) > .../local/lib/python3.12.../shared/torngit/github.py:714: in api > response = await self.make_http_call(*args, token_to_use=token_to_use, **kwargs) > .../local/lib/python3.12.../shared/torngit/github.py:889: in make_http_call > res = await client.request(method, url, **kwargs) > .../local/lib/python3.12.../site-packages/httpx/_client.py:1533: in request > return await self.send(request, auth=auth, follow_redirects=follow_redirects) > .../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:124: in _async_vcr_send > vcr_request, response = _shared_vcr_send(cassette, real_send, *args, **kwargs) > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > > cassette = <vcr.cassette.Cassette object at 0x7f2772f93710> > real_send = <function AsyncClient.send at 0x7f277e56da80> > args = (<httpx.AsyncClient object at 0x7f2772eced50>, <Request('POST', 'https://api.github.com/graphql')>) > kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7f277e7ad5e0>, 'follow_redirects': False} > real_request = <Request('POST', 'https://api.github.com/graphql')> > vcr_request = <Request (POST) https://api.github.com/graphql> > > def _shared_vcr_send(cassette, real_send, *args, **kwargs): > real_request = args[1] > > vcr_request = _make_vcr_request(real_request, **kwargs) > > if cassette.can_play_response_for(vcr_request): > return vcr_request, _play_responses(cassette, real_request, vcr_request, args[0], kwargs) > > if cassette.write_protected and cassette.filter_request(vcr_request): > > raise CannotOverwriteExistingCassetteException(cassette=cassette, failed_request=vcr_request) > E vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('.../test_notify_task/TestNotifyTask/test_simple_call_status_and_notifiers.yaml') in your current record mode ('once'). > E No match for the request (<Request (POST) https://api.github.com/graphql>) was found. > E Found 3 similar requests with 1 different matcher(s) : > E > E 1 - (<Request (POST) https://api.github..../issues/1/comments>). > E Matchers succeeded : ['method', 'scheme', 'host', 'port'] > E Matchers failed : > E path - assertion failure : > E /graphql != .../issues/1/comments > E > E 2 - (<Request (POST) https://api.github..../codecov-demo/statuses/5601846871b8142ab0df1e0b8774756c658bcc7d>). > E Matchers succeeded : ['method', 'scheme', 'host', 'port'] > E Matchers failed : > E path - assertion failure : > E /graphql != .../codecov-demo/statuses/5601846871b8142ab0df1e0b8774756c658bcc7d > E > E 3 - (<Request (POST) https://api.github..../issues/9/comments>). > E Matchers succeeded : ['method', 'scheme', 'host', 'port'] > E Matchers failed : > E path - assertion failure : > E /graphql != .../issues/9/comments > > .../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:79: CannotOverwriteExistingCassetteException > ```
To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard
Test Failures Detected: Due to failing tests, we cannot provide coverage reports at this time.
Completed 1786 tests with 8 failed
, 1778 passed and 0 skipped.
self = <worker.tasks.tests.integration.test_notify_task.TestNotifyTask object at 0x7f27758beb70>- **Class name:** tasks.tests.integration.test_sync_pull.TestPullSyncTask
mock_post_request = <MagicMock name='post' id='139807406992336'>
dbsession = <sqlalchemy.orm.session.Session object at 0x7f277309a540>
mocker = <pytest_mock.plugin.MockFixture object at 0x7f2773106060>
codecov_vcr = <vcr.cassette.Cassette object at 0x7f2772f93710>
mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f2772d3f650>
mock_configuration = <shared.config.ConfigHelper object at 0x7f2772d499d0>
is_not_first_pull = None
@patch("requests.post")
def test_simple_call_status_and_notifiers(
self,
mock_post_request,
dbsession,
mocker,
codecov_vcr,
mock_storage,
mock_configuration,
is_not_first_pull,
):
mock_post_request.return_value.status_code = 200
mock_configuration.params["setup"]["codecov_dashboard_url"] = (
"https://myexamplewebsite.io"
)
mocker.patch.object(NotifyTask, "app")
repository = RepositoryFactory.create(
owner__unencrypted_oauth_token=sample_token,
owner__username="joseph-sentry",
owner__service="github",
owner__service_id="136376984",
owner__email="joseph.sawaya@sentry.io",
name="codecov-demo",
image_token="abcdefghij",
)
dbsession.add(repository)
dbsession.flush()
head_commitid = "5601846871b8142ab0df1e0b8774756c658bcc7d"
master_sha = "5b174c2b40d501a70c479e91025d5109b1ad5c1b"
master_commit = CommitFactory.create(
message="",
pullid=None,
branch="main",
commitid=master_sha,
repository=repository,
author=repository.owner,
)
# create another pull so that we don't trigger the 1st time comment message
dbsession.add(PullFactory.create(repository=repository, pullid=8))
commit = CommitFactory.create(
message="",
pullid=9,
branch="test",
commitid=head_commitid,
parent_commit_id=master_commit.commitid,
repository=repository,
author=repository.owner,
)
dbsession.add(commit)
dbsession.add(master_commit)
dbsession.flush()
task = NotifyTask()
with open(".../tests/samples/sample_chunks_1.txt") as f:
content = f.read().encode()
archive_hash = ArchiveService.get_archive_hash(commit.repository)
chunks_url = f"v4/repos/{archive_hash}/commits/{commit.commitid}/chunks.txt"
mock_storage.write_file("archive", chunks_url, content)
master_chunks_url = (
f"v4/repos/{archive_hash}/commits/{master_commit.commitid}/chunks.txt"
)
mock_storage.write_file("archive", master_chunks_url, content)
> result = task.run_impl_within_lock(
dbsession,
repoid=commit.repoid,
commitid=commit.commitid,
current_yaml={
"comment": {
"layout": "reach, diff, flags, files, footer",
"behavior": "default",
"require_changes": [
CoverageCommentRequiredChanges.no_requirements.value
],
"require_base": False,
"require_head": True,
},
"coverage": {
"status": {"project": True, "patch": True, "changes": True},
"notify": {
"webhook": {
"default": {
"url": "https://6da6786648c8a8e5b8b09bc6562af8b4.m.pipedream.net"
}
},
"slack": {
"default": {
"url": "https://hooks.slack..../testkylhk/test01hg7/testohfnij1e83uy4xt8sxml"
}
},
},
},
},
)
.../tests/integration/test_notify_task.py:861:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tasks/notify.py:334: in run_impl_within_lock
enriched_pull = async_to_sync(
.../local/lib/python3.12....../site-packages/asgiref/sync.py:277: in __call__
return call_result.result()
.../local/lib/python3.12....../concurrent/futures/_base.py:449: in result
return self.__get_result()
.../local/lib/python3.12....../concurrent/futures/_base.py:401: in __get_result
raise self._exception
.../local/lib/python3.12....../site-packages/asgiref/sync.py:353: in main_wrap
result = await self.awaitable(*args, **kwargs)
.../local/lib/python3.12....../site-packages/sentry_sdk/tracing_utils.py:645: in func_with_tracing
return await func(*args, **kwargs)
services/repository.py:480: in fetch_and_update_pull_request_information_from_commit
enriched_pull = await fetch_and_update_pull_request_information(
.../local/lib/python3.12....../site-packages/sentry_sdk/tracing_utils.py:645: in func_with_tracing
return await func(*args, **kwargs)
services/repository.py:536: in fetch_and_update_pull_request_information
pull_information = await repository_service.get_pull_request(pullid=pullid)
.../local/lib/python3.12.../shared/torngit/github.py:2040: in get_pull_request
res = await self.api(client, "post", url, body=query, token=token)
.../local/lib/python3.12.../shared/torngit/github.py:714: in api
response = await self.make_http_call(*args, token_to_use=token_to_use, **kwargs)
.../local/lib/python3.12.../shared/torngit/github.py:889: in make_http_call
res = await client.request(method, url, **kwargs)
.../local/lib/python3.12.../site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
.../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:124: in _async_vcr_send
vcr_request, response = _shared_vcr_send(cassette, real_send, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cassette = <vcr.cassette.Cassette object at 0x7f2772f93710>
real_send = <function AsyncClient.send at 0x7f277e56da80>
args = (<httpx.AsyncClient object at 0x7f2772eced50>, <Request('POST', 'https://api.github.com/graphql')>)
kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7f277e7ad5e0>, 'follow_redirects': False}
real_request = <Request('POST', 'https://api.github.com/graphql')>
vcr_request = <Request (POST) https://api.github.com/graphql>
def _shared_vcr_send(cassette, real_send, *args, **kwargs):
real_request = args[1]
vcr_request = _make_vcr_request(real_request, **kwargs)
if cassette.can_play_response_for(vcr_request):
return vcr_request, _play_responses(cassette, real_request, vcr_request, args[0], kwargs)
if cassette.write_protected and cassette.filter_request(vcr_request):
> raise CannotOverwriteExistingCassetteException(cassette=cassette, failed_request=vcr_request)
E vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('.../test_notify_task/TestNotifyTask/test_simple_call_status_and_notifiers.yaml') in your current record mode ('once').
E No match for the request (<Request (POST) https://api.github.com/graphql>) was found.
E Found 3 similar requests with 1 different matcher(s) :
E
E 1 - (<Request (POST) https://api.github..../issues/1/comments>).
E Matchers succeeded : ['method', 'scheme', 'host', 'port']
E Matchers failed :
E path - assertion failure :
E /graphql != .../issues/1/comments
E
E 2 - (<Request (POST) https://api.github..../codecov-demo/statuses/5601846871b8142ab0df1e0b8774756c658bcc7d>).
E Matchers succeeded : ['method', 'scheme', 'host', 'port']
E Matchers failed :
E path - assertion failure :
E /graphql != .../codecov-demo/statuses/5601846871b8142ab0df1e0b8774756c658bcc7d
E
E 3 - (<Request (POST) https://api.github..../issues/9/comments>).
E Matchers succeeded : ['method', 'scheme', 'host', 'port']
E Matchers failed :
E path - assertion failure :
E /graphql != .../issues/9/comments
.../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:79: CannotOverwriteExistingCassetteException
self = <worker.tasks.tests.integration.test_sync_pull.TestPullSyncTask object at 0x7f27758d17f0>- **Class name:** tasks.tests.unit.test_commit_update.TestCommitUpdate
dbsession = <sqlalchemy.orm.session.Session object at 0x7f27732a4da0>
codecov_vcr = <vcr.cassette.Cassette object at 0x7f2772d49940>
mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f27730871d0>
mocker = <pytest_mock.plugin.MockFixture object at 0x7f27732a5700>
mock_redis = <MagicMock name='_get_redis_instance_from_url()' id='139807406996896'>
def test_call_task(self, dbsession, codecov_vcr, mock_storage, mocker, mock_redis):
mocker.patch.object(PullSyncTask, "app")
task = PullSyncTask()
repository = RepositoryFactory.create(
owner__username="ThiagoCodecov",
owner__service="github",
owner__service_id="44376991",
name="example-python",
owner__unencrypted_oauth_token="testduhiiri16grurxduwjexioy26ohqhaxvk67z",
)
report_json = {
"files": {
"README.md": [
2,
[0, 10, 8, 2, 0, "80.00000", 0, 0, 0, 0, 0, 0, 0],
[[0, 10, 8, 2, 0, "80.00000", 0, 0, 0, 0, 0, 0, 0]],
[0, 2, 1, 1, 0, "50.00000", 0, 0, 0, 0, 0, 0, 0],
],
"codecov.yaml": [
0,
[0, 3, 2, 1, 0, "66.66667", 0, 0, 0, 0, 0, 0, 0],
[[0, 3, 2, 1, 0, "66.66667", 0, 0, 0, 0, 0, 0, 0]],
None,
],
"tests/test_sample.py": [
1,
[0, 7, 7, 0, 0, "100", 0, 0, 0, 0, 0, 0, 0],
[[0, 7, 7, 0, 0, "100", 0, 0, 0, 0, 0, 0, 0]],
None,
],
},
"sessions": {
"0": {
"N": None,
"a": ".../4434BC2A2EC4FCA57F77B473D83F928C/abf6d4df662c47e32460020ab14abf9303581429/9ccc55a1-8b41-4bb1-a946-ee7a33a7fb56.txt",
"c": None,
"d": 1547084427,
"e": None,
"f": ["unit"],
"j": None,
"n": None,
"p": None,
"t": [3, 20, 17, 3, 0, "85.00000", 0, 0, 0, 0, 0, 0, 0],
"": None,
}
},
}
dbsession.add(repository)
dbsession.flush()
base_commit = CommitFactory.create(
repository=repository, commitid="7a7153d24f76c9ad58f421bcac8276203d589b1a"
)
head_commit = CommitFactory.create(
repository=repository,
commitid="6dc3afd80a8deea5ea949d284d996d58811cd01d",
branch="new_branch",
_report_json=report_json,
)
archive_hash = ArchiveService.get_archive_hash(repository)
with open(here.parent.parent / "samples" / "sample_chunks_1.txt") as f:
head_chunks_url = (
f"v4/repos/{archive_hash}/commits/{head_commit.commitid}/chunks.txt"
)
content = f.read()
mock_storage.write_file("archive", head_chunks_url, content)
pull = PullFactory.create(
pullid=17,
repository=repository,
base=base_commit.commitid,
head=head_commit.commitid,
)
dbsession.add(base_commit)
dbsession.add(head_commit)
dbsession.add(pull)
dbsession.flush()
> res = task.run_impl(dbsession, repoid=pull.repoid, pullid=pull.pullid)
.../tests/integration/test_sync_pull.py:86:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tasks/sync_pull.py:79: in run_impl
return self.run_impl_within_lock(
tasks/sync_pull.py:161: in run_impl_within_lock
enriched_pull = async_to_sync(fetch_and_update_pull_request_information)(
.../local/lib/python3.12....../site-packages/asgiref/sync.py:277: in __call__
return call_result.result()
.../local/lib/python3.12....../concurrent/futures/_base.py:449: in result
return self.__get_result()
.../local/lib/python3.12....../concurrent/futures/_base.py:401: in __get_result
raise self._exception
.../local/lib/python3.12....../site-packages/asgiref/sync.py:353: in main_wrap
result = await self.awaitable(*args, **kwargs)
.../local/lib/python3.12.../site-packages/sentry_sdk/tracing_utils.py:645: in func_with_tracing
return await func(*args, **kwargs)
services/repository.py:536: in fetch_and_update_pull_request_information
pull_information = await repository_service.get_pull_request(pullid=pullid)
.../local/lib/python3.12.../shared/torngit/github.py:2040: in get_pull_request
res = await self.api(client, "post", url, body=query, token=token)
.../local/lib/python3.12.../shared/torngit/github.py:714: in api
response = await self.make_http_call(*args, token_to_use=token_to_use, **kwargs)
.../local/lib/python3.12.../shared/torngit/github.py:889: in make_http_call
res = await client.request(method, url, **kwargs)
.../local/lib/python3.12.../site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
.../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:124: in _async_vcr_send
vcr_request, response = _shared_vcr_send(cassette, real_send, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cassette = <vcr.cassette.Cassette object at 0x7f2772d49940>
real_send = <function AsyncClient.send at 0x7f277e56da80>
args = (<httpx.AsyncClient object at 0x7f27733663f0>, <Request('POST', 'https://api.github.com/graphql')>)
kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7f277e7ad5e0>, 'follow_redirects': False}
real_request = <Request('POST', 'https://api.github.com/graphql')>
vcr_request = <Request (POST) https://api.github.com/graphql>
def _shared_vcr_send(cassette, real_send, *args, **kwargs):
real_request = args[1]
vcr_request = _make_vcr_request(real_request, **kwargs)
if cassette.can_play_response_for(vcr_request):
return vcr_request, _play_responses(cassette, real_request, vcr_request, args[0], kwargs)
if cassette.write_protected and cassette.filter_request(vcr_request):
> raise CannotOverwriteExistingCassetteException(cassette=cassette, failed_request=vcr_request)
E vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('.../test_sync_pull/TestPullSyncTask/test_call_task.yaml') in your current record mode ('once').
E No match for the request (<Request (POST) https://api.github.com/graphql>) was found.
E Found 9 similar requests with 2 different matcher(s) :
E
E 1 - (<Request (GET) https://api.github..../example-python/pulls/17>).
E Matchers succeeded : ['scheme', 'host', 'port']
E Matchers failed :
E method - assertion failure :
E POST != GET
E path - assertion failure :
E /graphql != .../example-python/pulls/17
E
E 2 - (<Request (GET) https://api.github..../example-python/pulls/17/commits>).
E Matchers succeeded : ['scheme', 'host', 'port']
E Matchers failed :
E method - assertion failure :
E POST != GET
E path - assertion failure :
E /graphql != .../example-python/pulls/17/commits
E
E 3 - (<Request (GET) https://api.github..../ThiagoCodecov/example-python/contents&ref=thiago%2Ff%2Fsomething>).
E Matchers succeeded : ['scheme', 'host', 'port']
E Matchers failed :
E method - assertion failure :
E POST != GET
E path - assertion failure :
E /graphql != .../ThiagoCodecov/example-python/contents
E
E 4 - (<Request (GET) https://api.github..../ThiagoCodecov/example-python/contents/codecov.yaml&ref=thiago%2Ff%2Fsomething>).
E Matchers succeeded : ['scheme', 'host', 'port']
E Matchers failed :
E method - assertion failure :
E POST != GET
E path - assertion failure :
E /graphql != .../ThiagoCodecov/example-python/contents/codecov.yaml
E
E 5 - (<Request (GET) https://api.github..../example-python/pulls/17>).
E Matchers succeeded : ['scheme', 'host', 'port']
E Matchers failed :
E method - assertion failure :
E POST != GET
E path - assertion failure :
E /graphql != .../example-python/pulls/17
E
E 6 - (<Request (GET) https://api.github..../example-python/pulls/17/commits>).
E Matchers succeeded : ['scheme', 'host', 'port']
E Matchers failed :
E method - assertion failure :
E POST != GET
E path - assertion failure :
E /graphql != .../example-python/pulls/17/commits
E
E 7 - (<Request (GET) https://api.github..../example-python/compare/6dc3afd80a8deea5ea949d284d996d58811cd01d...6dc3afd80a8deea5ea949d284d996d58811cd01d>).
E Matchers succeeded : ['scheme', 'host', 'port']
E Matchers failed :
E method - assertion failure :
E POST != GET
E path - assertion failure :
E /graphql != .../example-python/compare/6dc3afd80a8deea5ea949d284d996d58811cd01d...6dc3afd80a8deea5ea949d284d996d58811cd01d
E
E 8 - (<Request (GET) https://api.github..../example-python/pulls/17/commits>).
E Matchers succeeded : ['scheme', 'host', 'port']
E Matchers failed :
E method - assertion failure :
E POST != GET
E path - assertion failure :
E /graphql != .../example-python/pulls/17/commits
E
E 9 - (<Request (GET) https://api.github..../ThiagoCodecov/example-python/commits&sha=master>).
E Matchers succeeded : ['scheme', 'host', 'port']
E Matchers failed :
E method - assertion failure :
E POST != GET
E path - assertion failure :
E /graphql != .../ThiagoCodecov/example-python/commits
.../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:79: CannotOverwriteExistingCassetteException
self = <worker.tasks.tests.unit.test_commit_update.TestCommitUpdate object at 0x7f27757f00b0>- **Class name:** tasks.tests.unit.test_upload_task.TestUploadTaskIntegration
mocker = <pytest_mock.plugin.MockFixture object at 0x7f277234fcb0>
mock_configuration = <shared.config.ConfigHelper object at 0x7f27726588c0>
dbsession = <sqlalchemy.orm.session.Session object at 0x7f27722b6060>
codecov_vcr = <vcr.cassette.Cassette object at 0x7f277273ff50>
mock_redis = <MagicMock name='_get_redis_instance_from_url()' id='139807399713088'>
celery_app = <Celery celery.tests at 0x7f277273d010>
def test_update_commit(
self,
mocker,
mock_configuration,
dbsession,
codecov_vcr,
mock_redis,
celery_app,
):
mocker.patch.object(CommitUpdateTask, "app", celery_app)
commit = CommitFactory.create(
message="",
commitid="a2d3e3c30547a000f026daa47610bb3f7b63aece",
repository__owner__unencrypted_oauth_token="ghp_test3c8iyfspq6h4s9ugpmq19qp7826rv20o",
repository__owner__username="test-acc9",
repository__owner__service="github",
repository__owner__service_id="104562106",
repository__name="test_example",
)
dbsession.add(commit)
dbsession.flush()
> result = CommitUpdateTask().run_impl(dbsession, commit.repoid, commit.commitid)
.../tests/unit/test_commit_update.py:38:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tasks/commit_update.py:44: in run_impl
was_updated = async_to_sync(possibly_update_commit_from_provider_info)(
.../local/lib/python3.12....../site-packages/asgiref/sync.py:277: in __call__
return call_result.result()
.../local/lib/python3.12....../concurrent/futures/_base.py:449: in result
return self.__get_result()
.../local/lib/python3.12....../concurrent/futures/_base.py:401: in __get_result
raise self._exception
.../local/lib/python3.12....../site-packages/asgiref/sync.py:353: in main_wrap
result = await self.awaitable(*args, **kwargs)
services/repository.py:212: in possibly_update_commit_from_provider_info
await update_commit_from_provider_info(repository_service, commit)
.../local/lib/python3.12.../site-packages/sentry_sdk/tracing_utils.py:645: in func_with_tracing
return await func(*args, **kwargs)
services/repository.py:273: in update_commit_from_provider_info
commit_updates = await repository_service.get_pull_request(
.../local/lib/python3.12.../shared/torngit/github.py:2040: in get_pull_request
res = await self.api(client, "post", url, body=query, token=token)
.../local/lib/python3.12.../shared/torngit/github.py:714: in api
response = await self.make_http_call(*args, token_to_use=token_to_use, **kwargs)
.../local/lib/python3.12.../shared/torngit/github.py:889: in make_http_call
res = await client.request(method, url, **kwargs)
.../local/lib/python3.12.../site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
.../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:124: in _async_vcr_send
vcr_request, response = _shared_vcr_send(cassette, real_send, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cassette = <vcr.cassette.Cassette object at 0x7f277273ff50>
real_send = <function AsyncClient.send at 0x7f277e56da80>
args = (<httpx.AsyncClient object at 0x7f277279cd40>, <Request('POST', 'https://api.github.com/graphql')>)
kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7f277e7ad5e0>, 'follow_redirects': False}
real_request = <Request('POST', 'https://api.github.com/graphql')>
vcr_request = <Request (POST) https://api.github.com/graphql>
def _shared_vcr_send(cassette, real_send, *args, **kwargs):
real_request = args[1]
vcr_request = _make_vcr_request(real_request, **kwargs)
if cassette.can_play_response_for(vcr_request):
return vcr_request, _play_responses(cassette, real_request, vcr_request, args[0], kwargs)
if cassette.write_protected and cassette.filter_request(vcr_request):
> raise CannotOverwriteExistingCassetteException(cassette=cassette, failed_request=vcr_request)
E vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('.../test_commit_update/TestCommitUpdate/test_update_commit.yaml') in your current record mode ('once').
E No match for the request (<Request (POST) https://api.github.com/graphql>) was found.
E Found 4 similar requests with 2 different matcher(s) :
E
E 1 - (<Request (GET) https://api.github..../test_example/commits/a2d3e3c30547a000f026daa47610bb3f7b63aece>).
E Matchers succeeded : ['scheme', 'host', 'port']
E Matchers failed :
E method - assertion failure :
E POST != GET
E path - assertion failure :
E /graphql != .../test_example/commits/a2d3e3c30547a000f026daa47610bb3f7b63aece
E
E 2 - (<Request (GET) https://api.github..../test_example/pulls/1>).
E Matchers succeeded : ['scheme', 'host', 'port']
E Matchers failed :
E method - assertion failure :
E POST != GET
E path - assertion failure :
E /graphql != .../test_example/pulls/1
E
E 3 - (<Request (GET) https://api.github..../test_example/pulls/1/commits&per_page=250>).
E Matchers succeeded : ['scheme', 'host', 'port']
E Matchers failed :
E method - assertion failure :
E POST != GET
E path - assertion failure :
E /graphql != .../test_example/pulls/1/commits
E
E 4 - (<Request (GET) https://api.github..../test-acc9/test_example/commits&sha=a2d3e3c30547a000f026daa47610bb3f7b63aece>).
E Matchers succeeded : ['scheme', 'host', 'port']
E Matchers failed :
E method - assertion failure :
E POST != GET
E path - assertion failure :
E /graphql != .../test-acc9/test_example/commits
.../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:79: CannotOverwriteExistingCassetteException
self = <worker.tasks.tests.unit.test_upload_task.TestUploadTaskIntegration object at 0x7f2775344c80>- **Class name:** tasks.tests.unit.test_upload_task.TestUploadTaskIntegration
mocker = <pytest_mock.plugin.MockFixture object at 0x7f2770ec47a0>
mock_configuration = <shared.config.ConfigHelper object at 0x7f2772b81bb0>
dbsession = <sqlalchemy.orm.session.Session object at 0x7f2770ec5be0>
codecov_vcr = <vcr.cassette.Cassette object at 0x7f2772b5aa20>
mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f2772b44a40>
mock_redis = <worker.tasks.tests.unit.test_upload_task.FakeRedis object at 0x7f2772b475c0>
celery_app = <Celery celery.tests at 0x7f277280b230>
mock_checkpoint_submit = <Mock id='139807374994240'>
@pytest.mark.django_db(databases={"default"})
def test_upload_task_call(
self,
mocker,
mock_configuration,
dbsession,
codecov_vcr,
mock_storage,
mock_redis,
celery_app,
mock_checkpoint_submit,
):
mocked_1 = mocker.patch("tasks.upload.chain")
url = ".../C3C4715CA57C910D11D5EB899FC86A7E/4c4e4654ac25037ae869caeb3619d485970b6304/a84d445c-9c1e-434f-8275-f18f1f320f81.txt"
redis_queue = [{"url": url, "build": "some_random_build"}]
jsonified_redis_queue = [json.dumps(x) for x in redis_queue]
mocker.patch.object(UploadTask, "app", celery_app)
commit = CommitFactory.create(
message="",
commitid="abf6d4df662c47e32460020ab14abf9303581429",
repository__owner__unencrypted_oauth_token="test7lk5ndmtqzxlx06rip65nac9c7epqopclnoy",
repository__owner__username="ThiagoCodecov",
repository__owner__service="github",
repository__yaml={"codecov": {"max_report_age": "1y ago"}},
repository__name="example-python",
)
dbsession.add(commit)
dbsession.flush()
dbsession.refresh(commit)
repo_updatestamp = commit.repository.updatestamp
mock_redis.lists[f"uploads/{commit.repoid}/{commit.commitid}"] = (
jsonified_redis_queue
)
checkpoints = _create_checkpoint_logger(mocker)
kwargs = {_kwargs_key(UploadFlow): checkpoints.data}
> result = UploadTask().run_impl(
dbsession,
commit.repoid,
commit.commitid,
kwargs=kwargs,
)
.../tests/unit/test_upload_task.py:157:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tasks/upload.py:344: in run_impl
return self.run_impl_within_lock(
.../local/lib/python3.12....../site-packages/sentry_sdk/tracing_utils.py:673: in func_with_tracing
return func(*args, **kwargs)
tasks/upload.py:431: in run_impl_within_lock
was_updated = async_to_sync(possibly_update_commit_from_provider_info)(
.../local/lib/python3.12....../site-packages/asgiref/sync.py:277: in __call__
return call_result.result()
.../local/lib/python3.12....../concurrent/futures/_base.py:449: in result
return self.__get_result()
.../local/lib/python3.12....../concurrent/futures/_base.py:401: in __get_result
raise self._exception
.../local/lib/python3.12....../site-packages/asgiref/sync.py:353: in main_wrap
result = await self.awaitable(*args, **kwargs)
services/repository.py:212: in possibly_update_commit_from_provider_info
await update_commit_from_provider_info(repository_service, commit)
.../local/lib/python3.12....../site-packages/sentry_sdk/tracing_utils.py:645: in func_with_tracing
return await func(*args, **kwargs)
services/repository.py:273: in update_commit_from_provider_info
commit_updates = await repository_service.get_pull_request(
.../local/lib/python3.12.../shared/torngit/github.py:2040: in get_pull_request
res = await self.api(client, "post", url, body=query, token=token)
.../local/lib/python3.12.../shared/torngit/github.py:714: in api
response = await self.make_http_call(*args, token_to_use=token_to_use, **kwargs)
.../local/lib/python3.12.../shared/torngit/github.py:889: in make_http_call
res = await client.request(method, url, **kwargs)
.../local/lib/python3.12.../site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
.../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:124: in _async_vcr_send
vcr_request, response = _shared_vcr_send(cassette, real_send, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cassette = <vcr.cassette.Cassette object at 0x7f2772b5aa20>
real_send = <function AsyncClient.send at 0x7f277e56da80>
args = (<httpx.AsyncClient object at 0x7f2772859e20>, <Request('POST', 'https://api.github.com/graphql')>)
kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7f277e7ad5e0>, 'follow_redirects': False}
real_request = <Request('POST', 'https://api.github.com/graphql')>
vcr_request = <Request (POST) https://api.github.com/graphql>
def _shared_vcr_send(cassette, real_send, *args, **kwargs):
real_request = args[1]
vcr_request = _make_vcr_request(real_request, **kwargs)
if cassette.can_play_response_for(vcr_request):
return vcr_request, _play_responses(cassette, real_request, vcr_request, args[0], kwargs)
if cassette.write_protected and cassette.filter_request(vcr_request):
> raise CannotOverwriteExistingCassetteException(cassette=cassette, failed_request=vcr_request)
E vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('.../test_upload_task/TestUploadTaskIntegration/test_upload_task_call.yaml') in your current record mode ('once').
E No match for the request (<Request (POST) https://api.github.com/graphql>) was found.
E Found 1 similar requests with 1 different matcher(s) :
E
E 1 - (<Request (POST) https://api.github..../ThiagoCodecov/example-python/hooks>).
E Matchers succeeded : ['method', 'scheme', 'host', 'port']
E Matchers failed :
E path - assertion failure :
E /graphql != .../ThiagoCodecov/example-python/hooks
.../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:79: CannotOverwriteExistingCassetteException
self = <worker.tasks.tests.unit.test_upload_task.TestUploadTaskIntegration object at 0x7f2775344860>- **Class name:** tasks.tests.unit.test_upload_task.TestUploadTaskIntegration
mocker = <pytest_mock.plugin.MockFixture object at 0x7f2772631970>
mock_configuration = <shared.config.ConfigHelper object at 0x7f27711869f0>
dbsession = <sqlalchemy.orm.session.Session object at 0x7f2771187e00>
codecov_vcr = <vcr.cassette.Cassette object at 0x7f27724b28d0>
mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f2772b45190>
mock_redis = <worker.tasks.tests.unit.test_upload_task.FakeRedis object at 0x7f2772b92bd0>
celery_app = <Celery celery.tests at 0x7f2772b80170>
def test_upload_task_call_bundle_analysis(
self,
mocker,
mock_configuration,
dbsession,
codecov_vcr,
mock_storage,
mock_redis,
celery_app,
):
chain = mocker.patch("tasks.upload.chain")
mocker.patch(
"shared.django_apps.codecov_metrics.service.codecov_metrics.UserOnboardingMetricsService.create_user_onboarding_metric"
)
storage_path = (
".../testing/ed1bdd67-8fd2-4cdb-ac9e-39b99e4a3892/bundle_report.sqlite"
)
redis_queue = [{"url": storage_path, "build_code": "some_random_build"}]
jsonified_redis_queue = [json.dumps(x) for x in redis_queue]
mocker.patch.object(UploadTask, "app", celery_app)
commit = CommitFactory.create(
message="",
commitid="abf6d4df662c47e32460020ab14abf9303581429",
repository__owner__oauth_token="GHTZB+Mi+.../ubudnSKTJYb/fgN4hRJVJYSIErtidEsCLDJBb8DZzkbXqLujHAnv28aKShXddE/OffwRuwKug==",
repository__owner__username="ThiagoCodecov",
repository__owner__service="github",
repository__yaml={"codecov": {"max_report_age": "1y ago"}},
repository__name="example-python",
)
dbsession.add(commit)
dbsession.flush()
dbsession.refresh(commit)
mock_redis.lists[
f"uploads/{commit.repoid}/{commit.commitid}/bundle_analysis"
] = jsonified_redis_queue
> UploadTask().run_impl(
dbsession,
commit.repoid,
commit.commitid,
report_type="bundle_analysis",
)
.../tests/unit/test_upload_task.py:256:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tasks/upload.py:344: in run_impl
return self.run_impl_within_lock(
.../local/lib/python3.12....../site-packages/sentry_sdk/tracing_utils.py:673: in func_with_tracing
return func(*args, **kwargs)
tasks/upload.py:431: in run_impl_within_lock
was_updated = async_to_sync(possibly_update_commit_from_provider_info)(
.../local/lib/python3.12....../site-packages/asgiref/sync.py:277: in __call__
return call_result.result()
.../local/lib/python3.12....../concurrent/futures/_base.py:449: in result
return self.__get_result()
.../local/lib/python3.12....../concurrent/futures/_base.py:401: in __get_result
raise self._exception
.../local/lib/python3.12....../site-packages/asgiref/sync.py:353: in main_wrap
result = await self.awaitable(*args, **kwargs)
services/repository.py:212: in possibly_update_commit_from_provider_info
await update_commit_from_provider_info(repository_service, commit)
.../local/lib/python3.12....../site-packages/sentry_sdk/tracing_utils.py:645: in func_with_tracing
return await func(*args, **kwargs)
services/repository.py:273: in update_commit_from_provider_info
commit_updates = await repository_service.get_pull_request(
.../local/lib/python3.12.../shared/torngit/github.py:2040: in get_pull_request
res = await self.api(client, "post", url, body=query, token=token)
.../local/lib/python3.12.../shared/torngit/github.py:714: in api
response = await self.make_http_call(*args, token_to_use=token_to_use, **kwargs)
.../local/lib/python3.12.../shared/torngit/github.py:889: in make_http_call
res = await client.request(method, url, **kwargs)
.../local/lib/python3.12.../site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
.../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:124: in _async_vcr_send
vcr_request, response = _shared_vcr_send(cassette, real_send, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cassette = <vcr.cassette.Cassette object at 0x7f27724b28d0>
real_send = <function AsyncClient.send at 0x7f277e56da80>
args = (<httpx.AsyncClient object at 0x7f2773085610>, <Request('POST', 'https://api.github.com/graphql')>)
kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7f277e7ad5e0>, 'follow_redirects': False}
real_request = <Request('POST', 'https://api.github.com/graphql')>
vcr_request = <Request (POST) https://api.github.com/graphql>
def _shared_vcr_send(cassette, real_send, *args, **kwargs):
real_request = args[1]
vcr_request = _make_vcr_request(real_request, **kwargs)
if cassette.can_play_response_for(vcr_request):
return vcr_request, _play_responses(cassette, real_request, vcr_request, args[0], kwargs)
if cassette.write_protected and cassette.filter_request(vcr_request):
> raise CannotOverwriteExistingCassetteException(cassette=cassette, failed_request=vcr_request)
E vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('.../test_upload_task/TestUploadTaskIntegration/test_upload_task_call_bundle_analysis.yaml') in your current record mode ('once').
E No match for the request (<Request (POST) https://api.github.com/graphql>) was found.
E Found 1 similar requests with 1 different matcher(s) :
E
E 1 - (<Request (POST) https://api.github..../ThiagoCodecov/example-python/hooks>).
E Matchers succeeded : ['method', 'scheme', 'host', 'port']
E Matchers failed :
E path - assertion failure :
E /graphql != .../ThiagoCodecov/example-python/hooks
.../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:79: CannotOverwriteExistingCassetteException
self = <worker.tasks.tests.unit.test_upload_task.TestUploadTaskIntegration object at 0x7f2775347530>- **Class name:** tasks.tests.unit.test_upload_task.TestUploadTaskIntegration
mocker = <pytest_mock.plugin.MockFixture object at 0x7f27727f7d10>
mock_configuration = <shared.config.ConfigHelper object at 0x7f27727f5370>
dbsession = <sqlalchemy.orm.session.Session object at 0x7f27727f5c10>
codecov_vcr = <vcr.cassette.Cassette object at 0x7f27727f43b0>
mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f27725bcb00>
mock_redis = <worker.tasks.tests.unit.test_upload_task.FakeRedis object at 0x7f2770d4d850>
celery_app = <Celery celery.tests at 0x7f277333cb00>
@pytest.mark.django_db(databases={"default"})
def test_upload_task_call_multiple_processors(
self,
mocker,
mock_configuration,
dbsession,
codecov_vcr,
mock_storage,
mock_redis,
celery_app,
):
mocked_1 = mocker.patch("tasks.upload.chain")
redis_queue = [
{"build": "part1", "url": "someurl1"},
{"build": "part2", "url": "someurl2"},
{"build": "part3", "url": "someurl3"},
{"build": "part4", "url": "someurl4"},
{"build": "part5", "url": "someurl5"},
{"build": "part6", "url": "someurl6"},
{"build": "part7", "url": "someurl7"},
{"build": "part8", "url": "someurl8"},
]
jsonified_redis_queue = [json.dumps(x) for x in redis_queue]
mocker.patch.object(UploadTask, "app", celery_app)
commit = CommitFactory.create(
message="",
commitid="abf6d4df662c47e32460020ab14abf9303581429",
repository__owner__unencrypted_oauth_token="test7lk5ndmtqzxlx06rip65nac9c7epqopclnoy",
repository__owner__username="ThiagoCodecov",
repository__owner__service="github",
repository__yaml={"codecov": {"max_report_age": "1y ago"}},
repository__name="example-python",
)
dbsession.add(commit)
dbsession.flush()
mock_redis.lists[f"uploads/{commit.repoid}/{commit.commitid}"] = (
jsonified_redis_queue
)
> result = UploadTask().run_impl(dbsession, commit.repoid, commit.commitid)
.../tests/unit/test_upload_task.py:629:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tasks/upload.py:344: in run_impl
return self.run_impl_within_lock(
.../local/lib/python3.12....../site-packages/sentry_sdk/tracing_utils.py:673: in func_with_tracing
return func(*args, **kwargs)
tasks/upload.py:431: in run_impl_within_lock
was_updated = async_to_sync(possibly_update_commit_from_provider_info)(
.../local/lib/python3.12....../site-packages/asgiref/sync.py:277: in __call__
return call_result.result()
.../local/lib/python3.12....../concurrent/futures/_base.py:449: in result
return self.__get_result()
.../local/lib/python3.12....../concurrent/futures/_base.py:401: in __get_result
raise self._exception
.../local/lib/python3.12....../site-packages/asgiref/sync.py:353: in main_wrap
result = await self.awaitable(*args, **kwargs)
services/repository.py:212: in possibly_update_commit_from_provider_info
await update_commit_from_provider_info(repository_service, commit)
.../local/lib/python3.12....../site-packages/sentry_sdk/tracing_utils.py:645: in func_with_tracing
return await func(*args, **kwargs)
services/repository.py:273: in update_commit_from_provider_info
commit_updates = await repository_service.get_pull_request(
.../local/lib/python3.12.../shared/torngit/github.py:2040: in get_pull_request
res = await self.api(client, "post", url, body=query, token=token)
.../local/lib/python3.12.../shared/torngit/github.py:714: in api
response = await self.make_http_call(*args, token_to_use=token_to_use, **kwargs)
.../local/lib/python3.12.../shared/torngit/github.py:889: in make_http_call
res = await client.request(method, url, **kwargs)
.../local/lib/python3.12.../site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
.../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:124: in _async_vcr_send
vcr_request, response = _shared_vcr_send(cassette, real_send, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cassette = <vcr.cassette.Cassette object at 0x7f27727f43b0>
real_send = <function AsyncClient.send at 0x7f277e56da80>
args = (<httpx.AsyncClient object at 0x7f2770e72ed0>, <Request('POST', 'https://api.github.com/graphql')>)
kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7f277e7ad5e0>, 'follow_redirects': False}
real_request = <Request('POST', 'https://api.github.com/graphql')>
vcr_request = <Request (POST) https://api.github.com/graphql>
def _shared_vcr_send(cassette, real_send, *args, **kwargs):
real_request = args[1]
vcr_request = _make_vcr_request(real_request, **kwargs)
if cassette.can_play_response_for(vcr_request):
return vcr_request, _play_responses(cassette, real_request, vcr_request, args[0], kwargs)
if cassette.write_protected and cassette.filter_request(vcr_request):
> raise CannotOverwriteExistingCassetteException(cassette=cassette, failed_request=vcr_request)
E vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('.../test_upload_task/TestUploadTaskIntegration/test_upload_task_call_multiple_processors.yaml') in your current record mode ('once').
E No match for the request (<Request (POST) https://api.github.com/graphql>) was found.
E Found 1 similar requests with 1 different matcher(s) :
E
E 1 - (<Request (POST) https://api.github..../ThiagoCodecov/example-python/hooks>).
E Matchers succeeded : ['method', 'scheme', 'host', 'port']
E Matchers failed :
E path - assertion failure :
E /graphql != .../ThiagoCodecov/example-python/hooks
.../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:79: CannotOverwriteExistingCassetteException
self = <worker.tasks.tests.unit.test_upload_task.TestUploadTaskIntegration object at 0x7f27753455e0>- **Class name:** tasks.tests.unit.test_upload_task.TestUploadTaskIntegration
mocker = <pytest_mock.plugin.MockFixture object at 0x7f2772808470>
mock_configuration = <shared.config.ConfigHelper object at 0x7f27726455e0>
dbsession = <sqlalchemy.orm.session.Session object at 0x7f27724b2de0>
codecov_vcr = <vcr.cassette.Cassette object at 0x7f27724b1190>
mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f2770c324e0>
mock_redis = <worker.tasks.tests.unit.test_upload_task.FakeRedis object at 0x7f2770d4cf50>
celery_app = <Celery celery.tests at 0x7f2770df4f50>
def test_upload_task_call_test_results(
self,
mocker,
mock_configuration,
dbsession,
codecov_vcr,
mock_storage,
mock_redis,
celery_app,
):
chord = mocker.patch("tasks.upload.chord")
mocker.patch(
"shared.django_apps.codecov_metrics.service.codecov_metrics.UserOnboardingMetricsService.create_user_onboarding_metric"
)
storage_path = ".../C3C4715CA57C910D11D5EB899FC86A7E/4c4e4654ac25037ae869caeb3619d485970b6304/a84d445c-9c1e-434f-8275-f18f1f320f81.txt"
redis_queue = [{"url": storage_path, "build_code": "some_random_build"}]
jsonified_redis_queue = [json.dumps(x) for x in redis_queue]
mocker.patch.object(UploadTask, "app", celery_app)
commit = CommitFactory.create(
message="",
commitid="abf6d4df662c47e32460020ab14abf9303581429",
repository__owner__oauth_token="GHTZB+Mi+.../ubudnSKTJYb/fgN4hRJVJYSIErtidEsCLDJBb8DZzkbXqLujHAnv28aKShXddE/OffwRuwKug==",
repository__owner__username="ThiagoCodecov",
repository__owner__service="github",
repository__yaml={"codecov": {"max_report_age": "1y ago"}},
repository__name="example-python",
)
dbsession.add(commit)
dbsession.flush()
dbsession.refresh(commit)
mock_redis.lists[f"uploads/{commit.repoid}/{commit.commitid}/test_results"] = (
jsonified_redis_queue
)
> UploadTask().run_impl(
dbsession,
commit.repoid,
commit.commitid,
report_type="test_results",
)
.../tests/unit/test_upload_task.py:386:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tasks/upload.py:344: in run_impl
return self.run_impl_within_lock(
.../local/lib/python3.12....../site-packages/sentry_sdk/tracing_utils.py:673: in func_with_tracing
return func(*args, **kwargs)
tasks/upload.py:431: in run_impl_within_lock
was_updated = async_to_sync(possibly_update_commit_from_provider_info)(
.../local/lib/python3.12....../site-packages/asgiref/sync.py:277: in __call__
return call_result.result()
.../local/lib/python3.12....../concurrent/futures/_base.py:449: in result
return self.__get_result()
.../local/lib/python3.12....../concurrent/futures/_base.py:401: in __get_result
raise self._exception
.../local/lib/python3.12....../site-packages/asgiref/sync.py:353: in main_wrap
result = await self.awaitable(*args, **kwargs)
services/repository.py:212: in possibly_update_commit_from_provider_info
await update_commit_from_provider_info(repository_service, commit)
.../local/lib/python3.12....../site-packages/sentry_sdk/tracing_utils.py:645: in func_with_tracing
return await func(*args, **kwargs)
services/repository.py:273: in update_commit_from_provider_info
commit_updates = await repository_service.get_pull_request(
.../local/lib/python3.12.../shared/torngit/github.py:2040: in get_pull_request
res = await self.api(client, "post", url, body=query, token=token)
.../local/lib/python3.12.../shared/torngit/github.py:714: in api
response = await self.make_http_call(*args, token_to_use=token_to_use, **kwargs)
.../local/lib/python3.12.../shared/torngit/github.py:889: in make_http_call
res = await client.request(method, url, **kwargs)
.../local/lib/python3.12.../site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
.../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:124: in _async_vcr_send
vcr_request, response = _shared_vcr_send(cassette, real_send, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cassette = <vcr.cassette.Cassette object at 0x7f27724b1190>
real_send = <function AsyncClient.send at 0x7f277e56da80>
args = (<httpx.AsyncClient object at 0x7f2770d1dfd0>, <Request('POST', 'https://api.github.com/graphql')>)
kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7f277e7ad5e0>, 'follow_redirects': False}
real_request = <Request('POST', 'https://api.github.com/graphql')>
vcr_request = <Request (POST) https://api.github.com/graphql>
def _shared_vcr_send(cassette, real_send, *args, **kwargs):
real_request = args[1]
vcr_request = _make_vcr_request(real_request, **kwargs)
if cassette.can_play_response_for(vcr_request):
return vcr_request, _play_responses(cassette, real_request, vcr_request, args[0], kwargs)
if cassette.write_protected and cassette.filter_request(vcr_request):
> raise CannotOverwriteExistingCassetteException(cassette=cassette, failed_request=vcr_request)
E vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('.../test_upload_task/TestUploadTaskIntegration/test_upload_task_call_test_results.yaml') in your current record mode ('once').
E No match for the request (<Request (POST) https://api.github.com/graphql>) was found.
E Found 1 similar requests with 1 different matcher(s) :
E
E 1 - (<Request (POST) https://api.github..../ThiagoCodecov/example-python/hooks>).
E Matchers succeeded : ['method', 'scheme', 'host', 'port']
E Matchers failed :
E path - assertion failure :
E /graphql != .../ThiagoCodecov/example-python/hooks
.../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:79: CannotOverwriteExistingCassetteException
self = <worker.tasks.tests.unit.test_upload_task.TestUploadTaskIntegration object at 0x7f2775374230>
mocker = <pytest_mock.plugin.MockFixture object at 0x7f2770c31ac0>
mock_configuration = <shared.config.ConfigHelper object at 0x7f2772537800>
dbsession = <sqlalchemy.orm.session.Session object at 0x7f2772536f90>
codecov_vcr = <vcr.cassette.Cassette object at 0x7f2770e73c20>
mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7f2770e70aa0>
mock_redis = <worker.tasks.tests.unit.test_upload_task.FakeRedis object at 0x7f2771153110>
celery_app = <Celery celery.tests at 0x7f2772dec230>
def test_upload_task_proper_parent(
self,
mocker,
mock_configuration,
dbsession,
codecov_vcr,
mock_storage,
mock_redis,
celery_app,
):
mocked_1 = mocker.patch("tasks.upload.chain")
mocker.patch.object(UploadTask, "app", celery_app)
mocked_3 = mocker.patch.object(UploadContext, "arguments_list", return_value=[])
owner = OwnerFactory.create(
service="github",
username="ThiagoCodecov",
unencrypted_oauth_token="test76zow6xgh7modd88noxr245j2z25t4ustoff",
)
dbsession.add(owner)
repo = RepositoryFactory.create(
owner=owner,
yaml={"codecov": {"max_report_age": "1y ago"}},
name="example-python",
)
dbsession.add(repo)
parent_commit = CommitFactory.create(
message="",
commitid="c5b67303452bbff57cc1f49984339cde39eb1db5",
repository=repo,
)
commit = CommitFactory.create(
message="",
commitid="abf6d4df662c47e32460020ab14abf9303581429",
repository=repo,
)
dbsession.add(parent_commit)
dbsession.add(commit)
dbsession.flush()
redis_queue = [{"build": "part1"}]
jsonified_redis_queue = [json.dumps(x) for x in redis_queue]
mock_redis.lists[f"uploads/{commit.repoid}/{commit.commitid}"] = (
jsonified_redis_queue
)
mock_create_user_onboarding_metric = mocker.patch(
"shared.django_apps.codecov_metrics.service.codecov_metrics.UserOnboardingMetricsService.create_user_onboarding_metric"
)
> result = UploadTask().run_impl(dbsession, commit.repoid, commit.commitid)
.../tests/unit/test_upload_task.py:740:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tasks/upload.py:344: in run_impl
return self.run_impl_within_lock(
.../local/lib/python3.12....../site-packages/sentry_sdk/tracing_utils.py:673: in func_with_tracing
return func(*args, **kwargs)
tasks/upload.py:431: in run_impl_within_lock
was_updated = async_to_sync(possibly_update_commit_from_provider_info)(
.../local/lib/python3.12....../site-packages/asgiref/sync.py:277: in __call__
return call_result.result()
.../local/lib/python3.12....../concurrent/futures/_base.py:449: in result
return self.__get_result()
.../local/lib/python3.12....../concurrent/futures/_base.py:401: in __get_result
raise self._exception
.../local/lib/python3.12....../site-packages/asgiref/sync.py:353: in main_wrap
result = await self.awaitable(*args, **kwargs)
services/repository.py:212: in possibly_update_commit_from_provider_info
await update_commit_from_provider_info(repository_service, commit)
.../local/lib/python3.12....../site-packages/sentry_sdk/tracing_utils.py:645: in func_with_tracing
return await func(*args, **kwargs)
services/repository.py:273: in update_commit_from_provider_info
commit_updates = await repository_service.get_pull_request(
.../local/lib/python3.12.../shared/torngit/github.py:2040: in get_pull_request
res = await self.api(client, "post", url, body=query, token=token)
.../local/lib/python3.12.../shared/torngit/github.py:714: in api
response = await self.make_http_call(*args, token_to_use=token_to_use, **kwargs)
.../local/lib/python3.12.../shared/torngit/github.py:889: in make_http_call
res = await client.request(method, url, **kwargs)
.../local/lib/python3.12.../site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
.../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:124: in _async_vcr_send
vcr_request, response = _shared_vcr_send(cassette, real_send, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cassette = <vcr.cassette.Cassette object at 0x7f2770e73c20>
real_send = <function AsyncClient.send at 0x7f277e56da80>
args = (<httpx.AsyncClient object at 0x7f2772537770>, <Request('POST', 'https://api.github.com/graphql')>)
kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7f277e7ad5e0>, 'follow_redirects': False}
real_request = <Request('POST', 'https://api.github.com/graphql')>
vcr_request = <Request (POST) https://api.github.com/graphql>
def _shared_vcr_send(cassette, real_send, *args, **kwargs):
real_request = args[1]
vcr_request = _make_vcr_request(real_request, **kwargs)
if cassette.can_play_response_for(vcr_request):
return vcr_request, _play_responses(cassette, real_request, vcr_request, args[0], kwargs)
if cassette.write_protected and cassette.filter_request(vcr_request):
> raise CannotOverwriteExistingCassetteException(cassette=cassette, failed_request=vcr_request)
E vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('.../test_upload_task/TestUploadTaskIntegration/test_upload_task_proper_parent.yaml') in your current record mode ('once').
E No match for the request (<Request (POST) https://api.github.com/graphql>) was found.
E Found 1 similar requests with 1 different matcher(s) :
E
E 1 - (<Request (POST) https://api.github..../ThiagoCodecov/example-python/hooks>).
E Matchers succeeded : ['method', 'scheme', 'host', 'port']
E Matchers failed :
E path - assertion failure :
E /graphql != .../ThiagoCodecov/example-python/hooks
.../local/lib/python3.12.../vcr/stubs/httpx_stubs.py:79: CannotOverwriteExistingCassetteException
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.