gtg team mailing list archive
-
gtg team
-
Mailing list archive
-
Message #03059
[Bug 618311] Re: Very little error in test_datastore.py
This is the patch generated by bzr, which don't preserve removing of
spaces to be compliant with pep8.
[They were 26 errors, there's only 1 now.]
[The other little change isn't really import, also fixes one pep8
error.]
** Attachment added: "diff.txt"
https://bugs.launchpad.net/gtg/+bug/618311/+attachment/1492072/+files/diff.txt
--
Very little error in test_datastore.py
https://bugs.launchpad.net/bugs/618311
You received this bug notification because you are a member of Gtg
contributors, which is subscribed to Getting Things GNOME!.
Status in Getting Things GNOME!: New
Bug description:
[Running ./run_tests from repo]
This error won't happend all the time, actually just 1/20 of the time.
Why this happens ?
Because in the code, we have at a certain point this :
for temp in xrange(1, int(random.random() * 20)):
backend.fake_add_random_task()
The problem here is that if int(random.random() * 20) is 1. There will be no tasks.
[ Same behaviour as :
i = 0
while i < int(random()*2):
print "1"
That will only print "1" once in every 2 runs.
This makes that 1/20 times, this test result isn't correct.
Also in the patch, I also made some other improvements in the code of that module. (Using randint(start, limit) instead of int(random.random()*limit)
Hope the patch looks fine, I'm not very good in publishing my work. (I don't use patches or bazaar very often.)
References