On Tue, Feb 23, 2010 at 2:56 PM, Samuele Kaplun <[email protected]> wrote: > In data martedì 23 febbraio 2010 14:19:08, Victor Engmark ha scritto: >> On Tue, Feb 23, 2010 at 1:50 PM, Samuele Kaplun <[email protected]> > wrote: >> > In data martedì 23 febbraio 2010 13:11:37, Victor Engmark ha scritto: >> >> I'm having some trouble running unit tests that modify the database - >> >> They never seem to be able to do anything. Has anyone else seen this >> >> error before? Its explanation >> >> <http://dev.mysql.com/doc/refman/5.0/en/commands-out-of-sync.html> >> >> doesn't help much; >> >> vengmark@pcgssi10:/opt/cds-invenio/lib/python/invenio$ grep >> >> mysql_use_result * returned nothing. Also, >> >> vengmark@pcgssi10:/opt/cds-invenio/var/log$ grep -i mysql * >> >> returned only a lot of "Module _mysql was already imported" messages. >> >> >> >> vengmark@pcgssi10:~/src/cds-invenio/modules/webtag/lib (webtag)$ >> >> ./webtag_tests.py --yes-i-know >> >> ^CTraceback (most recent call last): >> >> [...] >> >> KeyboardInterrupt >> >> Exception _mysql_exceptions.ProgrammingError: (2014, "Commands out of >> >> sync; you can't run this command now") in <bound method Cursor.__del__ >> >> of <MySQLdb.cursors.Cursor object at 0x8f1df8c>> ignored >> > >> > for the Out of sync error, in this case, it most probably due to the >> > KeyboardInterrupt (caused by Ctrl-C) that you have hit. This normally >> > causes an unexpected loss of connection with MySQL which translates into >> > the Out of sync error. >> > >> > The "Module _mysql was already imported" messages are harmless (IMHO) and >> > they happens on Ubuntu... >> >> OK, thanks! >> >> > For the exact explanation of why you can't run the unittest unfortunately >> > I can't tell :-( I would need to see your particular file... >> >> This is the file: >> <http://cdsware.cern.ch/repo/?p=personal/cds-invenio-vengmark.git;a=blob;f= >> modules/webtag/lib/webtag_tests.py;hb=webtag>. When running it in IPython >> it says it runs 0 unit tests >> successfully... > > Have you tried using: > > $ from invenio.testutils import run_test_suite > > and then in your main instead of: > > $ return unittest.main() > > to use: > > $ run_test_suite(TEST_SUITE) > > This is the traditional way used in the other unit tests in Invenio. > I think the issue is related to unittest.main() not knowing what actually to > execute...
Tried it, and it just printed test_ascii_tags (__main__.TestTagInsert) ... and stopped. So I'm pretty sure the problem is with the DB. -- Victor Engmark
