Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix running async psycopg tests #2540

Merged
merged 5 commits into from
Jun 5, 2024

Conversation

xrmx
Copy link
Contributor

@xrmx xrmx commented May 22, 2024

Description

Tests were not run because the test case did not await on async tests. Split tests in two testcases: one for sync tests and one for async tests.

This is draft because a test still fails, I've fixed some trivial issues but I'm not a psycopg expert.

@federicobond Could you please take a look?

Fixes #2539

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • tox -e py310-test-instrumentation-psycopg

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@xrmx xrmx added the Skip Changelog PRs that do not require a CHANGELOG.md entry label May 22, 2024
@xrmx xrmx requested a review from federicobond May 22, 2024 11:11
@xrmx xrmx force-pushed the fix-asyncio-unittest-tests branch 2 times, most recently from 7b149eb to 10b7965 Compare May 22, 2024 11:17
@xrmx xrmx mentioned this pull request May 22, 2024
6 tasks
@xrmx xrmx force-pushed the fix-asyncio-unittest-tests branch 2 times, most recently from 64f7b48 to f6eff5b Compare May 23, 2024 07:43
@federicobond
Copy link
Member

Will look into this today or tomorrow.

@xrmx
Copy link
Contributor Author

xrmx commented May 23, 2024

I've tried to debug this a bit and it looks like the wrapped cursor is not used but since everything is mocked it may be just an issue with the mock themselves.

@xrmx xrmx force-pushed the fix-asyncio-unittest-tests branch from f6eff5b to 61f94fe Compare May 27, 2024 14:00
@xrmx xrmx marked this pull request as ready for review May 27, 2024 14:01
@xrmx xrmx requested a review from a team May 27, 2024 14:01
xrmx added 2 commits May 27, 2024 16:01
While at it remove pytes asyncio markers that are not needed when
running tests in IsolatedAsyncioTestCase
Tests were not run because the test case did not await on async tests.
Split tests in two testcases: one for sync tests and one for async tests.
@xrmx xrmx force-pushed the fix-asyncio-unittest-tests branch from 61f94fe to 10ab86f Compare May 27, 2024 14:01
@xrmx
Copy link
Contributor Author

xrmx commented May 27, 2024

The missing bits was an execute implementation in the async connection mock, marking as ready to review.

Copy link
Member

@aabmass aabmass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix

@lzchen
Copy link
Contributor

lzchen commented May 28, 2024

Will merge after @federicobond takes a look.

@lzchen lzchen merged commit 95fea2b into open-telemetry:main Jun 5, 2024
314 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some psycopg async tests don't run
4 participants