Automated tests

Python 2.6

/home/miki/1.9/pytest/py._test.pluginmanager:100: UserWarning: Module py was already imported from /home/miki/1.9/pytest/py, but /usr/local/lib/python2.6/dist-packages/py-1.4.0-py2.6.egg is being added to sys.path
/home/miki/1.9/MoinMoin/conftest.py:28: DeprecationWarning: py.magic.autopath deprecated, use py.path.local(__file__) and maybe pypkgpath/pyimport(). (since version 1.1)
  rootdir = py.magic.autopath().dirpath()
2010-12-04 19:28:51,168 WARNING MoinMoin.log:139 using logging configuration read from built-in fallback in MoinMoin.log module!
============================= test session starts ==============================
platform linux2 -- Python 2.6.6 -- pytest-1.3.4
[... skipped ...]
======== 1 failed, 1403 passed, 71 skipped, 30 error in 152.40 seconds =========

So actually one failure and 30 errors.

Failure

=================================== FAILURES ===================================
_____________________________ test_sourcecode[35] ______________________________

reldir = '/MoinMoin/_tests/test_user.py'
path = '/home/miki/1.9/MoinMoin/_tests/test_user.py', mtime = 1291300376.8830199

    def check_py_file(reldir, path, mtime):
        if TRAILING_SPACES == 'fix':
            f = file(path, 'rb')
            data = f.read()
            f.close()
            fixed = FIX_TS_RE.sub('', data)
    
            # Don't write files if there's no need for that,
            # as altering timestamps can be annoying with some tools.
            if fixed == data:
                return
    
            f = file(path, 'wb')
            f.write(fixed)
            f.close()
        # Please read and follow PEP8 - rerun this test until it does not fail any more,
        # any type of error is only reported ONCE (even if there are multiple).
        error_count = pep8_error_count(path)
>       assert error_count == 0
E       assert 10 == 0

_tests/test_sourcecode.py:95: AssertionError

This appears to be an error regarding the PEP8 style-guide.

Errors

TestXapianSearchStemmed.test_stemming

All the other errors are equal:

___________ ERROR at setup of TestXapianSearchStemmed.test_stemming ____________

self = <class 'test_search.TestXapianSearchStemmed'>

    def setup_class(self):
        try:
            from MoinMoin.search.Xapian import XapianIndex
            from MoinMoin.search.Xapian.search import XapianSearch
            self.searcher_class = XapianSearch
    
        except ImportError, error:
            if not str(error).startswith('Xapian '):
                raise
            py.test.skip('xapian is not installed')
    
        nuke_xapian_index(self.request)
        index = XapianIndex(self.request)
        # Additionally, pages which were not created but supposed to be searched
        # are indexed.
        pages_to_index = [page for page in self.pages if not self.pages[page]]
>       index.indexPages(mode='add', pages=pages_to_index)

search/_tests/test_search.py:472: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MoinMoin.search.Xapian.indexing.XapianIndex object at 0xaa5564c>
files = None, mode = 'add'
pages = [u'HelpOnCreoleSyntax', u'RecentChanges', u'FrontPage', u'CategoryHomepage', u'HelpIndex', u'HomePageWiki', ...]

    def indexPages(self, files=None, mode='update', pages=None):
        """ Index pages (and files, if given)
    
            @param files: iterator or list of files to index additionally
            @param mode: set the mode of indexing the pages, either 'update' or 'add'
            @param pages: list of pages to index, if not given, all pages are indexed
            """
        start = time.time()
        request = self._indexingRequest(self.request)
>       self._index_pages(request, files, mode, pages=pages)

search/builtin.py:158: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MoinMoin.search.Xapian.indexing.XapianIndex object at 0xaa5564c>
request = <AllContext ['AllContext']>, files = None, mode = 'add'
pages = [u'HelpOnCreoleSyntax', u'RecentChanges', u'FrontPage', u'CategoryHomepage', u'HelpIndex', u'HomePageWiki', ...]

    def _index_pages(self, request, files=None, mode='update', pages=None):
        """ Index all (given) pages (and all given files)
    
            This should be called from indexPages only!
    
            @param request: request suitable for indexing
            @param files: an optional list of files to index
            @param mode: 'add' = just add, no checks
                         'update' = check if already in index and update if needed (mtime)
            @param pages: list of pages to index, if not given, all pages are indexed
            """
        if pages is None:
            # Index all pages
            pages = request.rootpage.getPageList(user='', exists=1)
    
        try:
            connection = self.get_indexer_connection()
            self.touch()
            try:
                logging.info("indexing %d pages..." % len(pages))
                for pagename in pages:
>                   self._index_page(request, connection, pagename, mode=mode)

search/Xapian/indexing.py:553: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MoinMoin.search.Xapian.indexing.XapianIndex object at 0xaa5564c>
request = <AllContext ['AllContext']>
connection = <MoinMoin.search.Xapian.indexing.MoinIndexerConnection object at 0xaa5562c>
pagename = u'HomePageWiki', mode = 'add'

    def _index_page(self, request, connection, pagename, mode='update'):
        """ Index a page.
    
            Index all revisions (if wanted by configuration) and all attachments.
    
            @param request: request suitable for indexing
            @param connection: the Indexer connection object
            @param pagename: a page name
            @param mode: 'add' = just add, no checks
                         'update' = check if already in index and update if needed (mtime)
            """
        page = Page(request, pagename)
        revlist = page.getRevList() # recent revs first, does not include deleted revs
        logging.debug("indexing page %r, %d revs found" % (pagename, len(revlist)))
    
        if not revlist:
            # we have an empty revision list, that means the page is not there any more,
            # likely it (== all of its revisions, all of its attachments) got either renamed or nuked
            wikiname = request.cfg.interwikiname or u'Self'
    
            sc = self.get_search_connection()
            docs_to_delete = sc.get_all_documents_with_fields(wikiname=wikiname, pagename=pagename)
                                                              # any page rev, any attachment
            sc.close()
    
            for doc in docs_to_delete:
                connection.delete(doc.id)
            logging.debug('page %s (all revs, all attachments) removed from xapian index' % pagename)
    
        else:
            if request.cfg.xapian_index_history:
                index_revs, remove_revs = revlist, []
            else:
                if page.exists(): # is current rev not deleted?
                    index_revs, remove_revs = revlist[:1], revlist[1:]
                else:
                    index_revs, remove_revs = [], revlist
    
            for revno in index_revs:
>               updated = self._index_page_rev(request, connection, pagename, revno, mode=mode)

search/Xapian/indexing.py:364: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MoinMoin.search.Xapian.indexing.XapianIndex object at 0xaa5564c>
request = <AllContext ['AllContext']>
connection = <MoinMoin.search.Xapian.indexing.MoinIndexerConnection object at 0xaa5562c>
pagename = u'HomePageWiki', revno = 1, mode = 'add'

    def _index_page_rev(self, request, connection, pagename, revno, mode='update'):
        """ Index a page revision.
    
            @param request: request suitable for indexing
            @param connection: the Indexer connection object
            @param pagename: the page name
            @param revno: page revision number (int)
            @param mode: 'add' = just add, no checks
                         'update' = check if already in index and update if needed (mtime)
            """
        page = Page(request, pagename, rev=revno)
        request.page = page # XXX for what is this needed?
    
        wikiname = request.cfg.interwikiname or u"Self"
        revision = str(page.get_real_rev())
        itemid = "%s:%s:%s" % (wikiname, pagename, revision)
        mtime = page.mtime_usecs()
    
        doc = self._get_document(connection, itemid, mtime, mode)
        logging.debug("%s %s %r" % (pagename, revision, doc))
        if doc:
            mimetype = 'text/%s' % page.pi['format']  # XXX improve this
    
            fields = {}
            fields['wikiname'] = wikiname
            fields['pagename'] = pagename
            fields['attachment'] = '' # this is a real page, not an attachment
            fields['mtime'] = str(mtime)
            fields['revision'] = revision
            fields['title'] = pagename
            fields['content'] = page.get_raw_body()
>           fields['lang'], fields['stem_lang'] = self._get_languages(page)

search/Xapian/indexing.py:411: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MoinMoin.search.Xapian.indexing.XapianIndex object at 0xaa5564c>
page = <MoinMoin.Page.Page object at 0xad0502c>

    def _get_languages(self, page):
        """ Get language of a page and the language to stem it in
    
            @param page: the page instance
            """
        lang = None
        default_lang = page.request.cfg.language_default
    
        # if we should stem, we check if we have a stemmer for the language available
        if page.request.cfg.xapian_stemming:
            lang = page.pi['language']
            try:
>               xapian.Stem(lang)

search/Xapian/indexing.py:280: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MoinMoin.search.Xapian.xapian.Stem;  >

    def __init__(self, *args):
        """
            Construct a Xapian::Stem object for a particular language.
    
            Xapian::Stem::Stem(const std::string &language)
    
            Parameters:
            -----------
    
            language:  Either the English name for the language or the two letter
            ISO639 code.
    
            The following language names are understood (aliases follow the name):
    
            none - don't stem terms
    
            danish (da)
    
            dutch (nl)
    
            english (en) - Martin Porter's 2002 revision of his stemmer
    
            english_lovins (lovins) - Lovin's stemmer
    
            english_porter (porter) - Porter's stemmer as described in his 1980
            paper
    
            finnish (fi)
    
            french (fr)
    
            german (de)
    
            italian (it)
    
            norwegian (no)
    
            portuguese (pt)
    
            russian (ru)
    
            spanish (es)
    
            swedish (sv)
    
            Parameters:
            -----------
    
            Xapian::InvalidArgumentError:  is thrown if language isn't recognised.
    
            """
>       _xapian.Stem_swiginit(self,_xapian.new_Stem(*args))
E       InvalidArgumentError: Language code id unknown

search/Xapian/xapian.py:4410: InvalidArgumentError

This seems to be a xapian problem, and I have discovered that lang value is 'en' .

Python 2.4

/home/miki/1.9/MoinMoin/conftest.py:28: DeprecationWarning: py.magic.autopath deprecated, use py.path.local(__file__) and maybe pypkgpath/pyimport(). (since version 1.1)
  rootdir = py.magic.autopath().dirpath()
2010-12-03 17:57:41,983 WARNING MoinMoin.log:139 using logging configuration read from built-in fallback in MoinMoin.log module!
============================= test session starts ==============================
platform linux2 -- Python 2.4.6 -- pytest-1.3.4
test path 1: /home/miki/1.9/MoinMoin

_tests/test_Page.py .........
_tests/test_PageEditor.py ..........
_tests/test_caching.py .......
_tests/test_error.py ....
_tests/test_packages.py ........
_tests/test_sourcecode.py ...................................F..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................
[... skipped ...]
search/_tests/test_search.py ........................................EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE.
[... skipped ...]
======== 1 failed, 1341 passed, 72 skipped, 60 error in 122.11 seconds =========

With Python2.4 I get one failure and 60 errors.

Failure

This failure is the same as for the previous tests: it seems to be an error regarding the PEP8 style-guide.

_____________________________ test_sourcecode[35] ______________________________

reldir = '/MoinMoin/_tests/test_user.py'
path = '/home/miki/1.9/MoinMoin/_tests/test_user.py', mtime = 1291300376

    def check_py_file(reldir, path, mtime):
        if TRAILING_SPACES == 'fix':
            f = file(path, 'rb')
            data = f.read()
            f.close()
            fixed = FIX_TS_RE.sub('', data)
    
            # Don't write files if there's no need for that,
            # as altering timestamps can be annoying with some tools.
            if fixed == data:
                return
    
            f = file(path, 'wb')
            f.write(fixed)
            f.close()
        # Please read and follow PEP8 - rerun this test until it does not fail any more,
        # any type of error is only reported ONCE (even if there are multiple).
        error_count = pep8_error_count(path)
>       assert error_count == 0
E       assert 10 == 0

_tests/test_sourcecode.py:95: AssertionError

Errors

These 60 errors regard xapian again; this time there are unicode problems:

___________ ERROR at setup of TestXapianSearchStemmed.test_stemming ____________

self = <class 'test_search.TestXapianSearchStemmed'>

    def setup_class(self):
        try:
>           from MoinMoin.search.Xapian import XapianIndex

search/_tests/test_search.py:458: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    """
    
>   from MoinMoin.search.Xapian.indexing import XapianIndex, Query, MoinSearchConnection, MoinIndexerConnection, XapianDatabaseLockError

search/Xapian/__init__.py:10: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    """
    
    import os, re
>   import xapian

search/Xapian/indexing.py:12: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   import _xapian
E   ImportError: /home/miki/1.9/MoinMoin/search/Xapian/_xapian.so: undefined symbol: PyUnicodeUCS4_EncodeUTF8

{i} It happens because my Python is built with the UCS2 option and does not support UCS4. I tried everything but I cannot re-build my Python with the --enable-unicode=ucs4 option because otherwise there would be UCS2 problems.

Manual Testing

Before adding these results on the MoinMoin wiki page I set up the wiki user interface (where I wrote this page), and I triggered all the functionalities.

I tested the search, all the actions (Raw text, print view, attachments, etc.) and everything worked well except when I uploaded a file without extension.

I got this error message: No file content. Delete non ASCII characters from the file name and try again.

(!) Is this a regression?

→ This is not a regression because it happens on Python2.6 too.

MoinMoin: EasyToDo/test moin-1.9 current repo checkout with Python 2.4/Notes (last edited 2010-12-07 16:11:00 by host204-215-dynamic)