I have this file 'myclass.py' that contains the following 

class MyClass(object):
    @staticmethod
    def myt(l):
        """
        sage: from myclass import MyClass
        
        sage: MyClass.myt([1,2])
        [1, 2]
        """
        return l


when run sage -t myclass.py  ,  it gives errors about no module named 
myclass.   (details below)  


My previous code use this format  (e.g. from filename import ClassName  ... 
ClassName.foo for testing) and they worked before on Sage version <= 4.72 
and now they all report similar error (no module named filename) so 
something has changed in 4.8 that causes this problem ?  


Another problem I observed after install Sage 4.8 is also with sage -t   , 
 I change a name of a function and update the appropriate test in the 
comment section , run sage -t on the file  -- it keeps reporting the error 
in the "old" function -- in other words it does not see the new code.  Is 
it being cached somewhere ?  I have closed all Sage session and even del my 
~/.sage and restart the machine  but doesn't seem to help.   

All of the above problems occur on both of my Linux and Mac OS.   Basically 
now all my tests are broken.  



sage -t  "myclass.py"                                       
**********************************************************************
File "/Users/tnguyen/Dropbox/code/invgen/ig120123/myclass.py", line 7:
    sage: from myclass import MyClass
Exception raised:
    Traceback (most recent call last):
      File "/Users/tnguyen/Src/Devel/SAGE/sage/local/bin/ncadoctest.py", 
line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/Users/tnguyen/Src/Devel/SAGE/sage/local/bin/sagedoctest.py", 
line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, 
compileflags)
      File "/Users/tnguyen/Src/Devel/SAGE/sage/local/bin/ncadoctest.py", 
line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_0[2]>", line 1, in <module>
        from myclass import MyClass###line 7:
    sage: from myclass import MyClass
    ImportError: No module named myclass
**********************************************************************
File "/Users/tnguyen/Dropbox/code/invgen/ig120123/myclass.py", line 9:
    sage: MyClass.myt([1,2])
Exception raised:
    Traceback (most recent call last):
      File "/Users/tnguyen/Src/Devel/SAGE/sage/local/bin/ncadoctest.py", 
line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/Users/tnguyen/Src/Devel/SAGE/sage/local/bin/sagedoctest.py", 
line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, 
compileflags)
      File "/Users/tnguyen/Src/Devel/SAGE/sage/local/bin/ncadoctest.py", 
line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_0[3]>", line 1, in <module>
        MyClass.myt([Integer(1),Integer(2)])###line 9:
    sage: MyClass.myt([1,2])
    NameError: name 'MyClass' is not defined
**********************************************************************
1 items had failures:
   2 of   5 in __main__.example_0
***Test Failed*** 2 failures.
For whitespace errors, see the file 
/Users/tnguyen/.sage//tmp/myclass_2814.py
 [3.3 s]



-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to