pycontribs / pyrax

The Python SDK for the Rackspace Cloud
developer.rackspace.com
Apache License 2.0
237 stars 208 forks source link

Fix sporadically failing test #648

Closed drewbrew closed 5 years ago

drewbrew commented 5 years ago

Fix one test which is guaranteed to fail any time a random string comes up with a hyphen in it (roughly 1 in 976 chance of that happening)

Tested locally on py27, py34, py35, and py36.

Fixes #647

EdLeafe commented 5 years ago

I'm not sure that I follow the reason for this. Under the existing method, each character in the result is one of 968 (1000-32) possible unicode characters (str in py3). A length of 20 would generate 19,360 unique combinations; a length of 36 would generate 34,848. UUIDs contain 16 unique characters, all of which are simple ASCII, and the lengths above would generate 320 and 576 combinations, respectively.

How is this increasing randomness? And it would also seem that you are losing what this method is designed to do, namely provide non-ASCII strings.

drewbrew commented 5 years ago

I'm not intending to increase randomness at all. Most if not all of these tests don't need random data.

However, after looking at the CI flakiness, it's almost entirely focused on one test. I think I'm trying to kill a mole with a sledgehammer. Let me try something.

drewbrew commented 5 years ago

@EdLeafe take a look at the revised PR when you get a chance, please.

EdLeafe commented 5 years ago

So the issue was the presence of a hyphen? If so, this seems much cleaner.

drewbrew commented 5 years ago

It appears that way anyway. If more tests randomly fail, there are always more PRs.

EdLeafe commented 5 years ago

BTW, it's good to see people working to maintain pyrax until there is a path forward. I personally promised so many developers that it would always be supported, and for a while there it looked more like abandonware.

cardoe commented 5 years ago

I think if we need to do random value testing we should look at testing with something like QuickCheck.

drewbrew commented 5 years ago

Factory_boy is good too.