sympy tests not running

7 views
Skip to first unread message

Bharath M R

unread,
Feb 24, 2012, 6:10:29 AM2/24/12
to sy...@googlegroups.com
I created a branch on my desktop and tried to run the tests. All the tests in test_GA.py are not working. Should I report it as an issue?

Ondřej Čertík

unread,
Feb 24, 2012, 3:39:42 PM2/24/12
to sy...@googlegroups.com
Hi Bharath,

On Fri, Feb 24, 2012 at 3:10 AM, Bharath M R <catchmr...@gmail.com> wrote:
> I created a branch on my desktop and tried to run the tests. All the tests
> in test_GA.py are not working. Should I report it as an issue?

Yes, please do. Send the whole test output.

All tests should run.

Thanks,
Ondrej

Matthew Rocklin

unread,
Feb 24, 2012, 5:08:14 PM2/24/12
to sy...@googlegroups.com
I've also had this problem. My experience:
It only happens on a few machines
It only happens when I run all tests, not if I just test galgebra

I've run into this while running sympy bot before. Here is a printout from an old pull request

--
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.


Aaron Meurer

unread,
Feb 24, 2012, 8:13:34 PM2/24/12
to sy...@googlegroups.com
Is it consistently reproducible? We should try to get this fixed.

Aaron Meurer

Matthew Rocklin

unread,
Feb 24, 2012, 8:45:05 PM2/24/12
to sy...@googlegroups.com
> Is it consistently reproducible?  We should try to get this fixed.
It is consistent, yes.

Chris Smith

unread,
Feb 24, 2012, 9:14:33 PM2/24/12
to sy...@googlegroups.com
I believe it is failing because the broadcast mechanism is not working. It fails right from the start, as I recall, because things created with MV appear undefined. All subsequence expressions then generate errors.

Christian Bühler

unread,
Feb 25, 2012, 2:30:52 AM2/25/12
to sy...@googlegroups.com
Hm, sounds like probably my patch
(https://github.com/sympy/sympy/pull/1066) introduced the problem.
I'm sorry, but currently I cannot look at the problem because I have to
learn for my exams. If it still persists after March 1st, I will take
care of it.

Alan Bromborsky

unread,
Feb 25, 2012, 7:03:08 AM2/25/12
to sy...@googlegroups.com
I tried the following -

from inspect import currentframe
frame = currentframe().f_back

def test_frame():
frame.f_globals['x'] = (1,2)
return

test_frame()
print x

"""
Traceback (most recent call last):
File "frame.py", line 8, in <module>
test_frame()
File "frame.py", line 5, in test_frame
frame.f_globals['x'] = (1,2)
AttributeError: 'NoneType' object has no attribute 'f_globals'
"""

I am using python 2.7 and it appears currentframe().f_back is not a
dictionary.

Bharath M R

unread,
Feb 25, 2012, 7:23:22 AM2/25/12
to sy...@googlegroups.com
I have created an issue on the error that I am getting . Please refer Issue 3103.
Thanks,
Bharath M R

Aaron Meurer

unread,
Feb 25, 2012, 5:58:25 PM2/25/12
to sy...@googlegroups.com
Can someone explain why it's trying to mess with the frame? This is
very fragile, and very rarely needs to be done.

Aaron Meurer

> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.

> To view this discussion on the web visit
> https://groups.google.com/d/msg/sympy/-/-6EhDxmVB3sJ.

Alan Bromborsky

unread,
Feb 25, 2012, 7:16:26 PM2/25/12
to sy...@googlegroups.com
I wanted to inject some objects from the function setup() in the class
MV in the module GA into the name space of the main program. Christian
Buhler tried to fix some of the problems with my method by using the
technique in the sympy var() function. I now think it would be better
to forget about this altogether and remove the code from the program so
that the
only way to get access to the variables is to pass them from the program -

(e1,e2,e3)=MV.setup('e_1 e_2 e_3')

This has the advantage in that the name of the variable does not have to
be the variable symbol so that one can use a
short name in the program and a long desrciptive name in the output. In
my rewrite I print basis bases and blades in boldface. The only objects
that were injected into the global name space were the basis vectors and
there are only usually 3 to 6 of them max so that it is not worth the
effort to inject them!

Aaron Meurer

unread,
Feb 25, 2012, 9:14:39 PM2/25/12
to sy...@googlegroups.com
I would highly recommend changing this. Use of such hacks are, as I
said fragile, and un-Pythonic. var() is only intended for interactive
use. It's fine to have a similar function for interactive use, but
the main API should use regular name assignment.

Note that even var() doesn't always "work" as regular name assignment.
For example, suppose I have the following:

from sympy import var

def test():
var('x')
print x
def test2():
var('y')
print y
z = 1
test2()
print y
print z

test()

Now, if this worked like it should, the "print y" in test() but not in
test2() should raise a NameError, because it was only defined in the
scope of test2(). But if you run this, you get

x
y
y


Traceback (most recent call last):

File "<stdin>", line 1, in <module>
File "<stdin>", line 10, in test
NameError: global name 'z' is not defined

The two "y"s in the output show that the name is defined in both
places. The final NameError shows that this doesn't happen for
normally defined variables.

That's just one thing that can happen with this sort of thing. There
are other things too. Depending on what you do with the frame, it may
not be supported in alternate Python implementations like Jython,
PyPy, or IronPython. And see
http://code.google.com/p/sympy/issues/detail?id=1198 for an example of
where this sort of things would actually be useful, but it doesn't
work in all cases, so isn't.

Aaron Meurer

Christian Bühler

unread,
Mar 1, 2012, 8:15:00 AM3/1/12
to sy...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages