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

Ensure the tests can be ran independently with Python 3.11 #281

Merged
merged 1 commit into from
Jan 4, 2023

Conversation

pablogsal
Copy link
Member

As Python 3.11 allocates memory when a function is first traced, some of
our tests results are depending on the fact that the allocators don't
trigger when a function is traced for the first time (what happens is
that other tests warm the pymalloc allocator).

To avoid this, add a new context manager that allows to run a piece of
code under tracing to warmup the caches, including the calling function.
For the calling function to be included the context manager needs to be
implemented in C.

Issue number of the reported bug or feature request: #

Describe your changes
A clear and concise description of the changes you have made.

Testing performed
Describe the testing you have performed to ensure that the bug has been addressed, or that the new feature works as planned.

Additional context
Add any other context about your contribution here.

@pablogsal
Copy link
Member Author

I also tested that after this PR we can run every test individually in isolation by running:

python -m pytest tests  --co | grep test_ | grep Function | sed 's/<Function \(.*\)>/\1/' | xargs -n 1  pytest tests -v -k

As Python 3.11 allocates memory when a function is first traced, some of
our tests results are depending on the fact that the allocators don't
trigger when a function is traced for the first time (what happens is
that other tests warm the pymalloc allocator).

To avoid this, add a new context manager that allows to run a piece of
code under tracing to warmup the caches, including the calling function.
For the calling function to be included the context manager needs to be
implemented in C.

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Copy link
Contributor

@godlygeek godlygeek left a comment

Choose a reason for hiding this comment

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

LGTM

@pablogsal pablogsal enabled auto-merge (rebase) January 4, 2023 17:49
@pablogsal pablogsal merged commit 1073e89 into bloomberg:main Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants