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

Improve tests #112

Merged
merged 3 commits into from
Mar 6, 2024
Merged

Improve tests #112

merged 3 commits into from
Mar 6, 2024

Conversation

godlygeek
Copy link
Contributor

@godlygeek godlygeek commented Mar 6, 2024

Fix a few different issues that I noticed while working on #103:

  1. The PYTEST_ADDOPTS environment variable wasn't being passed through to pytest by tox, apparently due to our config file not using a wildcard where we meant to.
  2. Tox wasn't exercising Python 3.11 or 3.12 by default (even though our CI exercised them)
  3. One of our tests would fail if run in isolation due to libpthread "leaking" memory by saving a thread and its stack for later reuse.

I'm not sure if these ever worked, but at least with current versions of
tox you definitely need to provide a wildcard in order for them to be
passed along.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
We were already doing this explicitly in CI, but this commit updates us
to run the coverage tests with 3.12 instead of 3.11, and to test 3.12 by
default when tox is run from the command line.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
@godlygeek godlygeek self-assigned this Mar 6, 2024
When this test was selected to be run with `pytest -k` or `--lf`, it
would fail because of allocations made by the platform threading
implementation:

    - 8.0MiB allocated here:
        __pthread_create_2_1
        PyThread_start_new_thread
        ...

When it was run as part of the larger test suite, it would pass, because
the test suite had already started other threads, and paid that cost in
a place where we weren't looking for leaks.

Since we can't tell pthreads not to cache the pthread_t for later reuse,
the best we can do here is just raise all of our thresholds for this
test by a constant factor, so that the ones that are supposed to fail
will fail with or without an extra 8 MB allocation, and the ones that
are supposed to pass will pass with or without it as well.

This commit scales all of the sizes and limits used by this test up by
a factor of 4096 (and drops one of the test vectors, since we don't need
to leak 400 MB just to prove a point when we already know we fail after
leaking 40 MB).

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
@godlygeek godlygeek changed the title Fix test isolation Improve tests Mar 6, 2024
@godlygeek godlygeek requested a review from pablogsal March 6, 2024 23:18
@pablogsal pablogsal merged commit 9adee4a into bloomberg:main Mar 6, 2024
11 checks passed
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