-
Notifications
You must be signed in to change notification settings - Fork 996
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
Stateful tests found by randomly #15398
Comments
Here's another stateful failure with |
Here's another one: |
Another one with: |
Another one with: |
I've got a PR that fixes all (marked with 🚀) but the last one - 3916416581 it doesn't reproduce for me. @di can you reproduce that one? |
I was able to reproduce it locally once, but not every time. It's a weird failure, I would expect warehouse/warehouse/packaging/models.py Lines 520 to 525 in 675794b
But maybe |
I looked into this, and I think the only time we actually set the value on this column is either during the release-level I have a patch to have the ClassifierFactory create ordering based on insert sequence, but I don't want to add it to the mix until we either see more failures of this kind and can repro the failure. diff --git a/tests/common/db/classifiers.py b/tests/common/db/classifiers.py
index 01118c8bd..5339fa7f8 100644
--- a/tests/common/db/classifiers.py
+++ b/tests/common/db/classifiers.py
@@ -10,6 +10,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import factory
+
from warehouse.classifiers.models import Classifier
from .base import WarehouseFactory
@@ -18,3 +20,5 @@ from .base import WarehouseFactory
class ClassifierFactory(WarehouseFactory):
class Meta:
model = Classifier
+
+ ordering = factory.Sequence(lambda n: n) |
Alternately, instead of testing for an ordered list of classifiers in this test, we could compare the results as a set, so as to determine equivalent content for the resulting classifiers, as |
Well, |
This feels like #12701 again? |
Hmm, since we're natsorting them, maybe |
Well, Over here, we use the manually-sorted classifiers from the Lines 359 to 364 in 68c1db9
|
This one still seems to be happening, with |
Another: |
The resulting set uses normalized names as order. --randomly-seed=3916416581 --randomly-seed=3294924425 --randomly-seed=1890731092 Refs: pypi#15398 Signed-off-by: Mike Fiedler <[email protected]>
Another: |
Another: |
Resolves: --randomly-seed=46468882 --randomly-seed=1997427500 Refs: pypi#15398 Signed-off-by: Mike Fiedler <[email protected]>
Another:
|
Another:
https://github.com/pypi/warehouse/actions/runs/12305494574/job/34345230107 |
Replace faker providers known to occasionally fail with the unique faker (safe_email, user_name, ipv4_private Based on: FactoryBoy/factory_boy#305 See also: FactoryBoy/factory_boy#820 closes pypi#17734 relates to pypi#15398
List of test runs that expose a non-deterministic test result (failure) when run with a specific random seed (ordering).
To reproduce, use
TESTARGS="--randomly-seed=<SEED> -vvv" make tests
before adding to this list.Seeds:
7d32abd
(#15469)15d3495
(#15469)1f0aff8
(#15469)Original issue:
To reproduce:
TESTARGS="--randomly-seed=105155306 -vvv" make tests T=tests/unit/api/test_simple.py::TestSimpleDetail
(The
T
parameter is the narrowest scoping of tests I found that still exhibited the issue to save on a full test run.)Other seeds that fail the same test:
Failure:
Source test here:
warehouse/tests/unit/api/test_simple.py
Lines 240 to 286 in 38ba926
However it is likely something about the setup/teardown of other tests is mutating some state that's being left over.
P.S. There's a smattering of statements that don't actually assert, might be worth fixing once this test passes.
Example:
warehouse/tests/unit/api/test_simple.py
Lines 285 to 286 in 38ba926
Note the lack of a leading
assert
.The text was updated successfully, but these errors were encountered: