gtg team mailing list archive
-
gtg team
-
Mailing list archive
-
Message #03057
[Bug 618311] [NEW] Very little error in test_datastore.py
Public bug reported:
[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.)
** Affects: gtg
Importance: Undecided
Status: New
** Tags: patch
--
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.)
Follow ups
References