Repository navigation
Conversation
* this is a bug in the logic of the tests, now resolved * resolves #136
* wraps existing tests to report seeds alongside test-specific failure message * wrapper reports under any failure, regardless of if the specific failure is located in the test source or library code
…hecks * both scripts search for conda on path * environment script creates environments according to the testing matrix design in .github/workflows/test.yml * if this workflow changes in the future, this script will additionally need to be modified * it should be straightforward to maintain this script in tandem with the testing workflow e.g. with an agent * check script runs the tests, linting, and style checks as in the test.yml, lint.yml, and style.yml workflows * expects conda envs to have default names as created by conda-create-test-envs.sh script
Collaborator
Author
|
@akilnarayan, ironically the test failure was the result of a tolerance failure. Ubuntu 3.12, 13, and 14 passed, so this should still be good to go for review. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR:
tests/conftest.py:UNCERTAINSCI_TEST_SEEDif set, otherwise generates a new seed.scripts/conda-create-test-envs.shcreates Python environments according to versions listed in the project'spyproject.toml.scripts/conda-run-checks.shruns the tests, then lints and checks the code for style, analogous to the test.yml, lint.yml, and style.yml workflows.<script>.sh -h.There are a plethora of intermittent (seed-dependent) test failures that motivated this PR, including the tolerance failure shown below and a rare
optimize.bisectsign error (f(a) and f(b) must have different signs) inJacobiPolynomials.idistinv. This PR does not fix these bugs. Nonetheless, it adds the infrastructure to reproduce and classify them.Notes on Seeding Tests
conftest.pyuses a new, unique seed for each test unlessUNCERTAINSCI_TEST_SEEDis set, in which case it uses this seed for all tests asked for in the pytest call. For instance:pytest tests/would run all tests, each with a new, unique seed. For any test that fails,conftest.pywould print the seed used when the test failed.UNCERTAINSCI_TEST_SEED=1234 pytest tests/would run all tests with a seed of1234.UNCERTAINSCI_TEST_SEEDshould be set only when running a specific failing test.UNCERTAINSCI_TEST_SEED=3999024806 pytest 'tests/test_jacobipolys.py::IDistTestCase::test_fidist_jacobi'would runtest_fidist_jacobiwith a seed of3999024806(see examples below; this is indeed a failing seed).A few further notes on seeding tests:
np.randomand Python libraryrandomstates (seeded with the same seed).DiscreteUniformDistribution.mc_samples inUncertainSCI/distributions.pyuses its own unseededdefault_rng()initialized at import time not exposed by the public API. SeeDiscreteUniformDistribution.mc_samplesuses a module-level unseededdefault_rng()#137.Example
Running
UNCERTAINSCI_TEST_SEED=3999024806 pytest 'tests/test_jacobipolys.py::IDistTestCase::test_fidist_jacobi'yields
(full failure output)
AI Use
This follows a similar pattern of AI use as #134: I proposed an initial plan and went through several iterations with Claude before arriving at a final design. I then had Claude implement these changes and verified the work.