gtg team mailing list archive
-
gtg team
-
Mailing list archive
-
Message #03061
[Bug 618311] Re: Very little error in test_datastore.py
** Description changed:
- [Running ./run_tests from repo]
+ [Running ./run_tests from repo]
This error won't happend all the time, actually just 1/20 of the time.
- Why this happens ?
+ Why this happens ?
- Because in the code, we have at a certain point this :
+ 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()
+ backend.fake_add_random_task()
- The problem here is that if int(random.random() * 20) is 1. There will
+ 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"
+ 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)
+ int(random.random()*limit) and removed 25 of 26 pep8 errors.
- Hope the patch looks fine, I'm not very good in publishing my work. (I
+ I also changed one time.sleep(5) to time.sleep(2), it's enough time.
+ [This makes a 3s speedup when running the test suite.]
+
+ Hope the patch looks fine, I'm not very good in publishing my work. (I
don't use patches or bazaar very often.)
--
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) and removed 25 of 26 pep8 errors.
I also changed one time.sleep(5) to time.sleep(2), it's enough time. [This makes a 3s speedup when running the test suite.]
Hope the patch looks fine, I'm not very good in publishing my work. (I don't use patches or bazaar very often.)
References