|
I have a patch I developed, and I would like to run the trac unit tests to make sure I haven't broken anything. But when I try to run the unit tests following the instructions on the wiki at wiki/TracDev/ UnitTests, I can't. I get an import error that I haven't been able to make go away. I don't know if it is a trac problem, or a python problem, or if I have borked my version of python or trac, or if I am just borked in the head. Cause I am still a trac and python newbie. Here is the error. It is with Trac 0.11.1, running on Centos 5, and on Python 2.4.3. [root@kermit trac-0.11.1]# PYTHONPATH=. trac/test.py Traceback (most recent call last): File "trac/test.py", line 270, in ? unittest.main(defaultTest='suite') File "/usr/lib/python2.4/unittest.py", line 758, in __init__ self.parseArgs(argv) File "/usr/lib/python2.4/unittest.py", line 785, in parseArgs self.createTests() File "/usr/lib/python2.4/unittest.py", line 791, in createTests self.module) File "/usr/lib/python2.4/unittest.py", line 556, in loadTestsFromNames suites = [self.loadTestsFromName(name, module) for name in names] File "/usr/lib/python2.4/unittest.py", line 544, in loadTestsFromName test = obj() File "trac/test.py", line 236, in suite import trac.tests ImportError: No module named tests [root@kermit trac-0.11.1]# The symptoms seem to be that PYTHONPATH is being ignored. I get the same error message if I explicitly: $ export PYTHONPATH=. $ trac/test.py It also seems to be ignored because when I run strace on this: PYTHONPATH=. strace python trac/test.py I get the same message, but more importantly, I see no evidence that anyfiles in my trac subdirectory apart from test.py is being opened. All opens/fstats/... take place in /usr/lib/python and system directories. The same holds true if I don't use . but use /opt/trac/trac-0.11.1 where I have my trac setup located. Pointing it to being a python issue, or a local python screwup on my part is that if I replicate the directory structure and the generic structure of the files in trac/tests and do the import on python 2.4.4 on Windows, the imports work just fine. Does anyone have any hints as to what might be wrong, or what I have done wrong, or how to diagnose this further? Or even, what other forums or websites or irc channels might be good ones to ask this question on? Apart from that, trac in mod_python and tracd seem to be running just fine. Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Trac Development" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/trac-dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
jerry wrote: > I have a patch I developed, and I would like to run the trac unit > tests to make sure I haven't broken anything. But when I try to run > the unit tests following the instructions on the wiki at wiki/TracDev/ > UnitTests, I can't. I get an import error that I haven't been able to > make go away. > > I don't know if it is a trac problem, or a python problem, or if I > have borked my version of python or trac, or if I am just borked in > the head. Cause I am still a trac and python newbie. > > Here is the error. It is with Trac 0.11.1, running on Centos 5, and > on Python 2.4.3. > > [root@kermit trac-0.11.1]# PYTHONPATH=. trac/test.py > Traceback (most recent call last): > ... > import trac.tests > ImportError: No module named tests > [root@kermit trac-0.11.1]# > > The symptoms seem to be that PYTHONPATH is being ignored. Right, this is due to some magic performed by setuptools (have a look at the first and last lines of the /usr/lib/python2.4/lib/python2.4/site-packages/easy-install.pth file). This is quite annoying, as this makes it difficult to test a particular Trac checkout once you have already installed another version in the standard location. Either uninstall Trac and use only Trac from the working copy, or use virtualenv. -- Christian --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Trac Development" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/trac-dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
In reply to this post by jerry-110
I ran the following $ PYTHONPATH=. python -vv trac/test.py and cleaned up the output a bit to reduce it from 20K lines to 242 lines. But you can see that python never tries to open anything in trac/tests. [root@kermit trac-0.11.1]# PYTHONPATH=. python -vv trac/test.py # installing zipimport hook import zipimport # builtin # installed zipimport hook # trying ./site.py # trying ./os.py import posix # builtin # trying ./posixpath.py # trying ./stat.py # trying ./UserDict.py # trying ./copy_reg.py # trying ./types.py # trying /opt/trac/trac-0.11.1/japanese.py # trying /opt/trac/trac-0.11.1/encodings.py # trying /opt/trac/trac-0.11.1/codecs.py import _codecs # builtin # trying /opt/trac/trac-0.11.1/sitecustomize.py # trying /opt/trac/trac-0.11.1/warnings.py # trying /opt/trac/trac-0.11.1/linecache.py Python 2.4.3 (#1, May 24 2008, 13:47:28) [GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2 Type "help", "copyright", "credits" or "license" for more information. # trying /opt/trac/trac-0.11.1/trac/unittest.py # trying /opt/trac/trac-0.11.1/unittest.py # trying /opt/trac/trac-0.11.1/trac/time.py # trying /opt/trac/trac-0.11.1/time.py # trying /opt/trac/trac-0.11.1/trac/traceback.py # trying /opt/trac/trac-0.11.1/traceback.py # trying /opt/trac/trac-0.11.1/trac/pkg_resources.py # trying /opt/trac/trac-0.11.1/trac/re.py # trying /opt/trac/trac-0.11.1/re.py # trying /opt/trac/trac-0.11.1/trac/sre.py # trying /opt/trac/trac-0.11.1/sre.py # trying /opt/trac/trac-0.11.1/trac/sre_compile.py # trying /opt/trac/trac-0.11.1/sre_compile.py import _sre # builtin # trying /opt/trac/trac-0.11.1/trac/sre_constants.py # trying /opt/trac/trac-0.11.1/sre_constants.py # trying /opt/trac/trac-0.11.1/trac/sre_parse.py # trying /opt/trac/trac-0.11.1/sre_parse.py import imp # builtin # trying /opt/trac/trac-0.11.1/trac/new.py # trying /opt/trac/trac-0.11.1/new.py # trying /opt/trac/trac-0.11.1/trac/distutils.py # trying /opt/trac/trac-0.11.1/distutils.py # trying /opt/trac/trac-0.11.1/trac/string.py # trying /opt/trac/trac-0.11.1/string.py # trying /opt/trac/trac-0.11.1/trac/strop.py # trying /opt/trac/trac-0.11.1/strop.py # trying /opt/trac/trac-0.11.1/trac/pkgutil.py # trying /opt/trac/trac-0.11.1/pkgutil.py # trying /opt/trac/trac-0.11.1/trac/zlib.py # trying /opt/trac/trac-0.11.1/zlib.py # zipimport: zlib available # trying /opt/trac/trac-0.11.1/trac/fnmatch.py # trying /opt/trac/trac-0.11.1/fnmatch.py # trying /opt/trac/trac-0.11.1/trac/trac.py # trying /opt/trac/trac-0.11.1/trac/ConfigParser.py # trying /opt/trac/trac-0.11.1/ConfigParser.py # trying /opt/trac/trac-0.11.1/trac/locale.py # trying /opt/trac/trac-0.11.1/locale.py # trying /opt/trac/trac-0.11.1/trac/_locale.py # trying /opt/trac/trac-0.11.1/_locale.py # trying /opt/trac/trac-0.11.1/trac/tempfile.py # trying /opt/trac/trac-0.11.1/tempfile.py import errno # builtin # trying /opt/trac/trac-0.11.1/trac/random.py # trying /opt/trac/trac-0.11.1/random.py # trying /opt/trac/trac-0.11.1/trac/math.py # trying /opt/trac/trac-0.11.1/math.py # trying /opt/trac/trac-0.11.1/trac/binascii.py # trying /opt/trac/trac-0.11.1/binascii.py # trying /opt/trac/trac-0.11.1/trac/_random.py # trying /opt/trac/trac-0.11.1/_random.py # trying /opt/trac/trac-0.11.1/trac/fcntl.py # trying /opt/trac/trac-0.11.1/fcntl.py import thread # builtin # trying /opt/trac/trac-0.11.1/trac/urllib.py # trying /opt/trac/trac-0.11.1/urllib.py # trying /opt/trac/trac-0.11.1/trac/socket.py # trying /opt/trac/trac-0.11.1/socket.py # trying /opt/trac/trac-0.11.1/trac/_socket.py # trying /opt/trac/trac-0.11.1/_socket.py # trying /opt/trac/trac-0.11.1/trac/_ssl.py # trying /opt/trac/trac-0.11.1/_ssl.py # trying /opt/trac/trac-0.11.1/trac/urlparse.py # trying /opt/trac/trac-0.11.1/urlparse.py # trying /opt/trac/trac-0.11.1/trac/itertools.py # trying /opt/trac/trac-0.11.1/itertools.py # trying /opt/trac/trac-0.11.1/trac/operator.py # trying /opt/trac/trac-0.11.1/operator.py # trying /opt/trac/trac-0.11.1/trac/functools.py # trying /opt/trac/trac-0.11.1/functools.py # trying /opt/trac/trac-0.11.1/trac/hashlib.py # trying /opt/trac/trac-0.11.1/hashlib.py # trying /opt/trac/trac-0.11.1/trac/md5.py # trying /opt/trac/trac-0.11.1/md5.py # trying /opt/trac/trac-0.11.1/trac/genshi.py # trying /opt/trac/trac-0.11.1/trac/htmlentitydefs.py # trying /opt/trac/trac-0.11.1/htmlentitydefs.py dlopen("/root/.python-eggs/Genshi-0.5.1-py2.4-linux-i686.egg-tmp/ genshi/_speedups.so", 2); # trying /opt/trac/trac-0.11.1/trac/xml.py # trying /opt/trac/trac-0.11.1/xml.py # trying /opt/trac/trac-0.11.1/trac/_xmlplus.py # trying /opt/trac/trac-0.11.1/_xmlplus.py # trying /opt/trac/trac-0.11.1/trac/HTMLParser.py # trying /opt/trac/trac-0.11.1/HTMLParser.py # trying /opt/trac/trac-0.11.1/trac/markupbase.py # trying /opt/trac/trac-0.11.1/markupbase.py # trying /opt/trac/trac-0.11.1/trac/StringIO.py # trying /opt/trac/trac-0.11.1/StringIO.py # trying /opt/trac/trac-0.11.1/trac/datetime.py # trying /opt/trac/trac-0.11.1/datetime.py # trying /opt/trac/trac-0.11.1/trac/pytz.py # trying /opt/trac/trac-0.11.1/pytz.py # trying /opt/trac/trac-0.11.1/trac/threading.py # trying /opt/trac/trac-0.11.1/threading.py # trying /opt/trac/trac-0.11.1/trac/collections.py # trying /opt/trac/trac-0.11.1/collections.py # trying /opt/trac/trac-0.11.1/trac/atexit.py # trying /opt/trac/trac-0.11.1/atexit.py # trying /opt/trac/trac-0.11.1/trac/setuptools.py # trying /opt/trac/trac-0.11.1/trac/copy.py # trying /opt/trac/trac-0.11.1/copy.py # trying /opt/trac/trac-0.11.1/trac/org.py # trying /opt/trac/trac-0.11.1/org.py # trying /opt/trac/trac-0.11.1/trac/inspect.py # trying /opt/trac/trac-0.11.1/inspect.py # trying /opt/trac/trac-0.11.1/trac/dis.py # trying /opt/trac/trac-0.11.1/dis.py # trying /opt/trac/trac-0.11.1/trac/opcode.py # trying /opt/trac/trac-0.11.1/opcode.py # trying /opt/trac/trac-0.11.1/trac/tokenize.py # trying /opt/trac/trac-0.11.1/tokenize.py # trying /opt/trac/trac-0.11.1/trac/token.py # trying /opt/trac/trac-0.11.1/token.py # trying /opt/trac/trac-0.11.1/trac/getopt.py # trying /opt/trac/trac-0.11.1/getopt.py # trying /opt/trac/trac-0.11.1/trac/__future__.py # trying /opt/trac/trac-0.11.1/__future__.py import marshal # builtin # trying /opt/trac/trac-0.11.1/trac/glob.py # trying /opt/trac/trac-0.11.1/glob.py # trying /opt/trac/trac-0.11.1/trac/Pyrex.py # trying /opt/trac/trac-0.11.1/Pyrex.py # trying /opt/trac/trac-0.11.1/trac/mod_python.py # trying /opt/trac/trac-0.11.1/mod_python.py # trying /opt/trac/trac-0.11.1/trac/pdb.py # trying /opt/trac/trac-0.11.1/pdb.py # trying /opt/trac/trac-0.11.1/trac/cmd.py # trying /opt/trac/trac-0.11.1/cmd.py # trying /opt/trac/trac-0.11.1/trac/bdb.py # trying /opt/trac/trac-0.11.1/bdb.py # trying /opt/trac/trac-0.11.1/trac/repr.py # trying /opt/trac/trac-0.11.1/repr.py # trying /opt/trac/trac-0.11.1/trac/pprint.py # trying /opt/trac/trac-0.11.1/pprint.py # trying /opt/trac/trac-0.11.1/trac/cStringIO.py # trying /opt/trac/trac-0.11.1/cStringIO.py # trying /opt/trac/trac-0.11.1/trac/_apache.py # trying /opt/trac/trac-0.11.1/_apache.py # trying /opt/trac/trac-0.11.1/trac/BaseHTTPServer.py # trying /opt/trac/trac-0.11.1/BaseHTTPServer.py # trying /opt/trac/trac-0.11.1/trac/mimetools.py # trying /opt/trac/trac-0.11.1/mimetools.py # trying /opt/trac/trac-0.11.1/trac/rfc822.py # trying /opt/trac/trac-0.11.1/rfc822.py # trying /opt/trac/trac-0.11.1/trac/SocketServer.py # trying /opt/trac/trac-0.11.1/SocketServer.py # trying /opt/trac/trac-0.11.1/trac/Cookie.py # trying /opt/trac/trac-0.11.1/Cookie.py # trying /opt/trac/trac-0.11.1/trac/cPickle.py # trying /opt/trac/trac-0.11.1/cPickle.py # trying /opt/trac/trac-0.11.1/trac/cgi.py # trying /opt/trac/trac-0.11.1/cgi.py # trying /opt/trac/trac-0.11.1/trac/mimetypes.py # trying /opt/trac/trac-0.11.1/mimetypes.py # trying /opt/trac/trac-0.11.1/trac/weakref.py # trying /opt/trac/trac-0.11.1/weakref.py # trying /opt/trac/trac-0.11.1/trac/_weakref.py # trying /opt/trac/trac-0.11.1/_weakref.py # trying /opt/trac/trac-0.11.1/trac/pysqlite2.py # trying /opt/trac/trac-0.11.1/pysqlite2.py # trying /opt/trac/trac-0.11.1/trac/sqlite3.py # trying /opt/trac/trac-0.11.1/sqlite3.py # trying /opt/trac/trac-0.11.1/trac/sqlite.py # trying /opt/trac/trac-0.11.1/sqlite.py # trying /opt/trac/trac-0.11.1/trac/_sqlite.py # trying /opt/trac/trac-0.11.1/_sqlite.py # trying /opt/trac/trac-0.11.1/trac/mx.py # trying /opt/trac/trac-0.11.1/mx.py # trying /opt/trac/trac-0.11.1/trac/smtplib.py # trying /opt/trac/trac-0.11.1/smtplib.py # trying /opt/trac/trac-0.11.1/trac/base64.py # trying /opt/trac/trac-0.11.1/base64.py # trying /opt/trac/trac-0.11.1/trac/struct.py # trying /opt/trac/trac-0.11.1/struct.py # trying /opt/trac/trac-0.11.1/trac/hmac.py # trying /opt/trac/trac-0.11.1/hmac.py # trying /opt/trac/trac-0.11.1/trac/email.py # trying /opt/trac/trac-0.11.1/email.py # trying /opt/trac/trac-0.11.1/trac/quopri.py # trying /opt/trac/trac-0.11.1/quopri.py # trying /opt/trac/trac-0.11.1/trac/compiler.py # trying /opt/trac/trac-0.11.1/compiler.py # trying /opt/trac/trac-0.11.1/trac/parser.py # trying /opt/trac/trac-0.11.1/parser.py # trying /opt/trac/trac-0.11.1/trac/symbol.py # trying /opt/trac/trac-0.11.1/symbol.py # trying /opt/trac/trac-0.11.1/trac/gettext.py # trying /opt/trac/trac-0.11.1/gettext.py # trying /opt/trac/trac-0.11.1/trac/textwrap.py # trying /opt/trac/trac-0.11.1/textwrap.py # trying /opt/trac/trac-0.11.1/trac/shutil.py # trying /opt/trac/trac-0.11.1/shutil.py # trying /opt/trac/trac-0.11.1/trac/unicodedata.py # trying /opt/trac/trac-0.11.1/unicodedata.py # trying /opt/trac/trac-0.11.1/trac/doctest.py # trying /opt/trac/trac-0.11.1/doctest.py # trying /opt/trac/trac-0.11.1/trac/difflib.py # trying /opt/trac/trac-0.11.1/difflib.py # trying /opt/trac/trac-0.11.1/trac/heapq.py # trying /opt/trac/trac-0.11.1/heapq.py # trying /opt/trac/trac-0.11.1/trac/bisect.py # trying /opt/trac/trac-0.11.1/bisect.py # trying /opt/trac/trac-0.11.1/trac/_bisect.py # trying /opt/trac/trac-0.11.1/_bisect.py # trying /opt/trac/trac-0.11.1/trac/_heapq.py # trying /opt/trac/trac-0.11.1/_heapq.py # trying /opt/trac/trac-0.11.1/trac/readline.py # trying /opt/trac/trac-0.11.1/readline.py Traceback (most recent call last): File "trac/test.py", line 270, in ? unittest.main(defaultTest='suite') self.parseArgs(argv) self.createTests() self.module) suites = [self.loadTestsFromName(name, module) for name in names] test = obj() File "trac/test.py", line 236, in suite import trac.tests ImportError: No module named tests --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Trac Development" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/trac-dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
In reply to this post by Christian Boos-2
Thanks, I'll take a look at that. I was trying to test both from the work and virtualenv, but I'll definitely check that out. Thanks, Jerry On May 10, 2:54 pm, Christian Boos <[hidden email]> wrote: > jerry wrote: > > I have a patch I developed, and I would like to run the trac unit > > tests to make sure I haven't broken anything. But when I try to run > > the unit tests following the instructions on the wiki at wiki/TracDev/ > > UnitTests, I can't. I get an import error that I haven't been able to > > make go away. > > > I don't know if it is a trac problem, or a python problem, or if I > > have borked my version of python or trac, or if I am just borked in > > the head. Cause I am still a trac and python newbie. > > > Here is the error. It is with Trac 0.11.1, running on Centos 5, and > > on Python 2.4.3. > > > [root@kermit trac-0.11.1]# PYTHONPATH=. trac/test.py > > Traceback (most recent call last): > > ... > > import trac.tests > > ImportError: No module named tests > > [root@kermit trac-0.11.1]# > > > The symptoms seem to be that PYTHONPATH is being ignored. > > Right, this is due to some magic performed by setuptools (have a look at > the first and last lines of the > /usr/lib/python2.4/lib/python2.4/site-packages/easy-install.pth file). > > This is quite annoying, as this makes it difficult to test a particular > Trac checkout once you have already installed another version in the > standard location. Either uninstall Trac and use only Trac from the > working copy, or use virtualenv. > > -- Christian You received this message because you are subscribed to the Google Groups "Trac Development" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/trac-dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
In reply to this post by Christian Boos-2
Yes, so that helped me fix it. Running the tests in the virtual environment still didn't work -- I had to uninstall trac itself: [root@kermit trac-0.11.1]# easy_install -m Trac Searching for Trac Best match: Trac 0.11.1 Processing Trac-0.11.1-py2.4.egg Removing Trac 0.11.1 from easy-install.pth file ... [root@kermit trac-0.11.1]# And then the tests ran, and they ran just fine. Step Two: Figuring out what twill, pygments, and pytz are, and where to get them if they are needed. Thank you, Jerry --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Trac Development" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/trac-dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
> Running the tests in the virtual environment still didn't work -- I > had to uninstall trac itself: In theory this should work if you create the virtualenv with --no-site-packages. This does behave differently across platforms (iirc on FreeBSD, the sqlite module is among the things that don't get brought over). Tim --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Trac Development" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/trac-dev?hl=en -~----------~----~----~----~------~----~------~--~--- |
| Free forum by Nabble | Edit this page |
