Closed adrian-codecov closed 1 week ago
This PR includes changes to shared
. Please review them here: https://github.com/codecov/shared/compare/b9e83b2c2f072749bae36c18b80d384b8cc50d94...2da7534e6cae7f6d077f0956c1e0811f822d4d9d
Tests completed | Failed | Passed | Skipped |
---|---|---|---|
1786 | 8 | 1778 | 0 |
tasks.tests.unit.test_commit_update.TestCommitUpdate test_update_commit
Stack Traces | 0.087s run time
> > ``` > self = <worker.tasks.tests.unit.test_commit_update.TestCommitUpdate object at 0x7fcf385e4050> > mocker = <pytest_mock.plugin.MockFixture object at 0x7fcf354bbc50> > mock_configuration = <shared.config.ConfigHelper object at 0x7fcf35153320> > dbsession = <sqlalchemy.orm.session.Session object at 0x7fcf354cf560> > codecov_vcr = <vcr.cassette.Cassette object at 0x7fcf353553a0> > mock_redis = <MagicMock name='_get_redis_instance_from_url()' id='140527927645280'> > celery_app = <Celery celery.tests at 0x7fcf352781d0> > > 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 0x7fcf353553a0> > real_send = <function AsyncClient.send at 0x7fcf41359a80> > args = (<httpx.AsyncClient object at 0x7fcf3579c650>, <Request('POST', 'https://api.github.com/graphql')>) > kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7fcf41b0a330>, '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.11s run time
> > ``` > self = <worker.tasks.tests.integration.test_notify_task.TestNotifyTask object at 0x7fcf386b2a80> > mock_post_request = <MagicMock name='post' id='140527938037920'> > dbsession = <sqlalchemy.orm.session.Session object at 0x7fcf36a91940> > mocker = <pytest_mock.plugin.MockFixture object at 0x7fcf35df45f0> > codecov_vcr = <vcr.cassette.Cassette object at 0x7fcf36086e70> > mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7fcf35d33320> > mock_configuration = <shared.config.ConfigHelper object at 0x7fcf35d3e5d0> > 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 0x7fcf36086e70> > real_send = <function AsyncClient.send at 0x7fcf41359a80> > args = (<httpx.AsyncClient object at 0x7fcf35cc10d0>, <Request('POST', 'https://api.github.com/graphql')>) > kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7fcf41b0a330>, '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 #778 +/- ##
==========================================
- 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: |
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 0x7fcf386b2a80>- **Class name:** tasks.tests.integration.test_sync_pull.TestPullSyncTask
mock_post_request = <MagicMock name='post' id='140527938037920'>
dbsession = <sqlalchemy.orm.session.Session object at 0x7fcf36a91940>
mocker = <pytest_mock.plugin.MockFixture object at 0x7fcf35df45f0>
codecov_vcr = <vcr.cassette.Cassette object at 0x7fcf36086e70>
mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7fcf35d33320>
mock_configuration = <shared.config.ConfigHelper object at 0x7fcf35d3e5d0>
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 0x7fcf36086e70>
real_send = <function AsyncClient.send at 0x7fcf41359a80>
args = (<httpx.AsyncClient object at 0x7fcf35cc10d0>, <Request('POST', 'https://api.github.com/graphql')>)
kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7fcf41b0a330>, '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 0x7fcf386c5760>- **Class name:** tasks.tests.unit.test_commit_update.TestCommitUpdate
dbsession = <sqlalchemy.orm.session.Session object at 0x7fcf35d2b350>
codecov_vcr = <vcr.cassette.Cassette object at 0x7fcf35d2bdd0>
mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7fcf35d2a540>
mocker = <pytest_mock.plugin.MockFixture object at 0x7fcf35d2a4e0>
mock_redis = <MagicMock name='_get_redis_instance_from_url()' id='140527940212192'>
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 0x7fcf35d2bdd0>
real_send = <function AsyncClient.send at 0x7fcf41359a80>
args = (<httpx.AsyncClient object at 0x7fcf37b80b90>, <Request('POST', 'https://api.github.com/graphql')>)
kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7fcf41b0a330>, '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 0x7fcf385e4050>- **Class name:** tasks.tests.unit.test_upload_task.TestUploadTaskIntegration
mocker = <pytest_mock.plugin.MockFixture object at 0x7fcf354bbc50>
mock_configuration = <shared.config.ConfigHelper object at 0x7fcf35153320>
dbsession = <sqlalchemy.orm.session.Session object at 0x7fcf354cf560>
codecov_vcr = <vcr.cassette.Cassette object at 0x7fcf353553a0>
mock_redis = <MagicMock name='_get_redis_instance_from_url()' id='140527927645280'>
celery_app = <Celery celery.tests at 0x7fcf352781d0>
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 0x7fcf353553a0>
real_send = <function AsyncClient.send at 0x7fcf41359a80>
args = (<httpx.AsyncClient object at 0x7fcf3579c650>, <Request('POST', 'https://api.github.com/graphql')>)
kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7fcf41b0a330>, '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 0x7fcf38154ce0>- **Class name:** tasks.tests.unit.test_upload_task.TestUploadTaskIntegration
mocker = <pytest_mock.plugin.MockFixture object at 0x7fcf35ad8c50>
mock_configuration = <shared.config.ConfigHelper object at 0x7fcf35812f60>
dbsession = <sqlalchemy.orm.session.Session object at 0x7fcf356306b0>
codecov_vcr = <vcr.cassette.Cassette object at 0x7fcf35227890>
mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7fcf35633140>
mock_redis = <worker.tasks.tests.unit.test_upload_task.FakeRedis object at 0x7fcf359b81d0>
celery_app = <Celery celery.tests at 0x7fcf1ffa5850>
mock_checkpoint_submit = <Mock id='140527935536064'>
@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 0x7fcf35227890>
real_send = <function AsyncClient.send at 0x7fcf41359a80>
args = (<httpx.AsyncClient object at 0x7fcf35810b60>, <Request('POST', 'https://api.github.com/graphql')>)
kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7fcf41b0a330>, '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 0x7fcf381548f0>- **Class name:** tasks.tests.unit.test_upload_task.TestUploadTaskIntegration
mocker = <pytest_mock.plugin.MockFixture object at 0x7fcf354864b0>
mock_configuration = <shared.config.ConfigHelper object at 0x7fcf35387c20>
dbsession = <sqlalchemy.orm.session.Session object at 0x7fcf353868a0>
codecov_vcr = <vcr.cassette.Cassette object at 0x7fcf35385400>
mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7fcf35313c80>
mock_redis = <worker.tasks.tests.unit.test_upload_task.FakeRedis object at 0x7fcf358107a0>
celery_app = <Celery celery.tests at 0x7fcf35d2a090>
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 0x7fcf35385400>
real_send = <function AsyncClient.send at 0x7fcf41359a80>
args = (<httpx.AsyncClient object at 0x7fcf357c2300>, <Request('POST', 'https://api.github.com/graphql')>)
kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7fcf41b0a330>, '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 0x7fcf381575c0>- **Class name:** tasks.tests.unit.test_upload_task.TestUploadTaskIntegration
mocker = <pytest_mock.plugin.MockFixture object at 0x7fcf35529340>
mock_configuration = <shared.config.ConfigHelper object at 0x7fcf356be240>
dbsession = <sqlalchemy.orm.session.Session object at 0x7fcf356bcf20>
codecov_vcr = <vcr.cassette.Cassette object at 0x7fcf356be0c0>
mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7fcf354c66c0>
mock_redis = <worker.tasks.tests.unit.test_upload_task.FakeRedis object at 0x7fcf35aad0d0>
celery_app = <Celery celery.tests at 0x7fcf3611a000>
@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 0x7fcf356be0c0>
real_send = <function AsyncClient.send at 0x7fcf41359a80>
args = (<httpx.AsyncClient object at 0x7fcf37b6cc20>, <Request('POST', 'https://api.github.com/graphql')>)
kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7fcf41b0a330>, '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 0x7fcf38155670>- **Class name:** tasks.tests.unit.test_upload_task.TestUploadTaskIntegration
mocker = <pytest_mock.plugin.MockFixture object at 0x7fcf357c3c50>
mock_configuration = <shared.config.ConfigHelper object at 0x7fcf1ffa4140>
dbsession = <sqlalchemy.orm.session.Session object at 0x7fcf1ffa7350>
codecov_vcr = <vcr.cassette.Cassette object at 0x7fcf1ffa4b90>
mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7fcf1fb51760>
mock_redis = <worker.tasks.tests.unit.test_upload_task.FakeRedis object at 0x7fcf356f34a0>
celery_app = <Celery celery.tests at 0x7fcf35ad9af0>
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 0x7fcf1ffa4b90>
real_send = <function AsyncClient.send at 0x7fcf41359a80>
args = (<httpx.AsyncClient object at 0x7fcf359b87d0>, <Request('POST', 'https://api.github.com/graphql')>)
kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7fcf41b0a330>, '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 0x7fcf381642c0>
mocker = <pytest_mock.plugin.MockFixture object at 0x7fcf354c67b0>
mock_configuration = <shared.config.ConfigHelper object at 0x7fcf37b9dbb0>
dbsession = <sqlalchemy.orm.session.Session object at 0x7fcf35aaee70>
codecov_vcr = <vcr.cassette.Cassette object at 0x7fcf352c0110>
mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7fcf352c04a0>
mock_redis = <worker.tasks.tests.unit.test_upload_task.FakeRedis object at 0x7fcf356bd9d0>
celery_app = <Celery celery.tests at 0x7fcf357458b0>
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 0x7fcf352c0110>
real_send = <function AsyncClient.send at 0x7fcf41359a80>
args = (<httpx.AsyncClient object at 0x7fcf3583d280>, <Request('POST', 'https://api.github.com/graphql')>)
kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7fcf41b0a330>, '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
Tests completed | Failed | Passed | Skipped |
---|---|---|---|
1786 | 8 | 1778 | 0 |
tasks.tests.unit.test_commit_update.TestCommitUpdate test_update_commit
Stack Traces | 0.087s run time
> > ``` > self = <worker.tasks.tests.unit.test_commit_update.TestCommitUpdate object at 0x7fcf385e4050> > mocker = <pytest_mock.plugin.MockFixture object at 0x7fcf354bbc50> > mock_configuration = <shared.config.ConfigHelper object at 0x7fcf35153320> > dbsession = <sqlalchemy.orm.session.Session object at 0x7fcf354cf560> > codecov_vcr = <vcr.cassette.Cassette object at 0x7fcf353553a0> > mock_redis = <MagicMock name='_get_redis_instance_from_url()' id='140527927645280'> > celery_app = <Celery celery.tests at 0x7fcf352781d0> > > 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 0x7fcf353553a0> > real_send = <function AsyncClient.send at 0x7fcf41359a80> > args = (<httpx.AsyncClient object at 0x7fcf3579c650>, <Request('POST', 'https://api.github.com/graphql')>) > kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7fcf41b0a330>, '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.11s run time
> > ``` > self = <worker.tasks.tests.integration.test_notify_task.TestNotifyTask object at 0x7fcf386b2a80> > mock_post_request = <MagicMock name='post' id='140527938037920'> > dbsession = <sqlalchemy.orm.session.Session object at 0x7fcf36a91940> > mocker = <pytest_mock.plugin.MockFixture object at 0x7fcf35df45f0> > codecov_vcr = <vcr.cassette.Cassette object at 0x7fcf36086e70> > mock_storage = <shared.storage.memory.MemoryStorageService object at 0x7fcf35d33320> > mock_configuration = <shared.config.ConfigHelper object at 0x7fcf35d3e5d0> > 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 0x7fcf36086e70> > real_send = <function AsyncClient.send at 0x7fcf41359a80> > args = (<httpx.AsyncClient object at 0x7fcf35cc10d0>, <Request('POST', 'https://api.github.com/graphql')>) > kwargs = {'auth': <httpx._client.UseClientDefault object at 0x7fcf41b0a330>, '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
Build to latest changing a string name from the comments bot
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.