Yes, I observe the errors while running all test in various files :
$ ./bin/test
And in particular in the test_expr.py file.
But when I run only one
$ ./bin/test test_expr.py
there is no errors.
Therefore tests depends on the order of testing of files.
I determined that it is related with test_sums_products.py. When I run
$ ./bin/test test_sums_products.py test_expr.py
the errors begin fails.
And precisely with this lines:
assert Sum(1/x/(x - 1), (x, a, b)).doit() == -1/b - 1/(1 - a)
When I comment it, then all tests in all files are passed without errors.
It seems that it is related with caching.
If I add at the `test_sums_products.py` after this (#174):
assert Sum(1/x/(x - 1), (x, a, b)).doit() == -1/b - 1/(1 - a)
this line
clear_cache()
then all tests in all files are passed without errors.
So this is a solution apparently.
Another question that it seems that `./bin/test` utility doesn't clear
caching before file testings. I think it must to do it. So I create an
issue for it.
--
Alexey U.
Not really. But that was a great start!
Imho clearing the cache is never the solution. The underlying problem is
that Basic.keep_sign is not being cached properly. Basic.keep_sign
affects results, so it has to be part of the caching hash. This two-line
patch removes the failures:
diff --git a/sympy/core/cache.py b/sympy/core/cache.py
index af20ce1..24b5ca1 100644
--- a/sympy/core/cache.py
+++ b/sympy/core/cache.py
@@ -93,7 +93,8 @@ def wrapper(*args, **kw_args):
k = args + tuple(items)
else:
k = args
- k = k + tuple(map(lambda x: type(x), k))
+ from sympy.core import Basic
+ k = k + tuple(map(lambda x: type(x), k)) + tuple([Basic.keep_sign])
try:
return func_cache_it_cache[k]
except KeyError:
There might be ways of doing this that are cleaner implementation-wise
or conceptually. The underlying problem again is that there is global
state affecting sympy computations that the cache does not know about.
Another question that it seems that `./bin/test` utility doesn't clear
caching before file testings. I think it must to do it. So I create an
issue for it.
--You received this message because you are subscribed to the Google Groups "sympy" group.
To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
Yes, I ment that it is a temporary solution (insert clear_cache() in
pointed line) to avoid the influence of one test file to another ones.
But I agree that this solution hide the problems with caching errors,
which can be resolved too.
--
Alexey U.
--
Alexey U.
--
You received this message because you are subscribed to the Google Groups "sympy" group.
To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
Well, I forget about $SYMPY_USE_CACHE, and that the cache system can be
hard tested with the help of this environment variable.
But when I wrote about the clearing of cache (new issue 2341 created
just now) I ment that it will be better to isolate some groups of tests
(which are grouped in the files "test_something.py") from the other
groups, therefore to clear cache only after the every test file, and do
not switch off the entire cache system for every calculation at whole as
the $SYMPY_USE_CACHE variable does.
In this case the slowing down is not so significant:
(a) - do not clear cache for every file: 276.15 - 277.72 seconds.
(b) - clear cache after every test (test function): 273.70 - 274.49
seconds.
(c) - clear cache after every test file: 264.04 seconds.
P.S. I specially carried out twice, because I noticed that (b) is
insignificantly faster then (a) unexpectedly.
--
Alexey U.
We - can. (I can't becouse I have not enough knowlage about
Basic.keep_sign problem exactly).
In this thread we discover three problems:
(1) Hanging of your branch, which do not pass the tests.
(2) The influence of the tests to another, dependency of test utility
result on they order - becouse cache is not clearing while we test a set
of files (and while we are logicaly group them by test files)
(3) Basic.keep_sign
The (1) can be resolved with the help of (2) or (3) (those are
independent issues in any case), or even manually, as I wrote above, by
the adding clear_cashe() after pointed line, but it is turned out that
it is not quite good solution and only temporary to resolve (1)
immediately though.
And I suppose, of cause, that the Basic.keep_sign is changed in the sum
telescope procedure validly and with the reasons.
P.S. clearing of the cache is resolved in
[1] https://github.com/sympy/sympy/pull/293
--
Alexey U.