Automated tests

Python 2.6

/home/pbnan/moin/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-11-27 19:45:46,273 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.3
[... skipped ...]
==== 1453 passed, 75 skipped in 206.30 seconds ====

So actually no errors and two harmless warnings appeared. (1453+75=1528)

Python 2.7

2010-11-27 19:46:02,037 WARNING MoinMoin.log:139 using logging configuration read from built-in fallback in MoinMoin.log module!
==== test session starts ====
platform linux2 -- Python 2.7.0 -- pytest-1.3.4
[... skipped ...]
MoinMoin/_tests/test_packages.py ...F....
[... skipped ...]
MoinMoin/_tests/test_wikiutil.py ..........................................................................................................................................................................F...
[... skipped ...]
MoinMoin/util/_tests/test_lock.py .........F
[... skipped ...]
==== 3 failed, 1470 passed, 72 skipped in 147.83 seconds ====

So three failures are spotted. (3+1470+72=1545)

Failures

TestRealCreation.testListCreate:

self = <MoinMoin._tests.test_packages.TestRealCreation instance at 0x8a6366c>

    def testListCreate(self):
        package = PackagePages(self.request.rootpage.page_name, self.request)
        temp = tempfile.NamedTemporaryFile(suffix='.zip')
>       package.collectpackage(['FrontPage'], temp)

MoinMoin/_tests/test_packages.py:94: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MoinMoin.action.PackagePages.PackagePages instance at 0x8a5dd2c>
pagelist = ['FrontPage']
fileobject = <open file '<fdopen>', mode 'w+b' at 0x8a3b1d8>, pkgname = ''
include_attachments = False

    def collectpackage(self, pagelist, fileobject, pkgname="", include_attachments=False):
        """ Expects a list of pages as an argument, and fileobject to be an open
            file object, which a zipfile will get written to.
    
            @param pagelist: pages to package
            @param fileobject: open file object to write to
            @param pkgname: optional file name, to prevent self packaging
            @rtype: string or None
            @return: error message, if one happened
            @rtype: boolean
            @param include_attachments: True if you want attachments collected
            """
        _ = self.request.getText
        COMPRESSION_LEVEL = zipfile.ZIP_DEFLATED
    
        pages = []
        for pagename in pagelist:
            pagename = wikiutil.normalize_pagename(pagename, self.request.cfg)
            if pagename:
                page = Page(self.request, pagename)
                if page.exists() and self.request.user.may.read(pagename):
                    pages.append(page)
        if not pages:
            return (_('No pages like "%s"!') % wikiutil.escape(pagelist))
    
        # Set zipfile output
        zf = zipfile.ZipFile(fileobject, "w", COMPRESSION_LEVEL)
    
        cnt = 0
        userid = user.getUserIdentification(self.request)
        script = [packLine(['MoinMoinPackage', '1']), ]
    
        for page in pages:
            cnt += 1
            files = _get_files(self.request, page.page_name)
            script.append(packLine(["AddRevision", str(cnt), page.page_name, userid, "Created by the PackagePages action."]))
    
            timestamp = wikiutil.version2timestamp(page.mtime_usecs())
            zi = zipfile.ZipInfo(filename=str(cnt), date_time=datetime.fromtimestamp(timestamp).timetuple()[:6])
            zi.compress_type = COMPRESSION_LEVEL
>           zf.writestr(zi, page.get_raw_body().encode("utf-8"))

MoinMoin/action/PackagePages.py:206: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <zipfile.ZipFile instance at 0x8a601ac>
zinfo_or_arcname = <zipfile.ZipInfo object at 0x89d932c>
bytes = 'US\xc1N\x1b1\x10\xbd\xfb+\xa6\xca\x01\xa8Br\x8f\x08U\xa1\xa5Tj\x01\x15$TE9x7\x93]7^{k{IR\xca\xbf\xf7\x8dM)=\xec\xc6\x...fe\xfb\x9a\x97,\r\x81\xa5\xd2\xcbb\xc9P\xfb-6d%]^,\xda\x94\xfa\xd9t\xda!\xa5\xf3\x13\xe3\xa6\xbf\xff",\x97\x13\xf5\x07'
compress_type = None

    def writestr(self, zinfo_or_arcname, bytes, compress_type=None):
        """Write a file into the archive.  The contents is the string
            'bytes'.  'zinfo_or_arcname' is either a ZipInfo instance or
            the name of the file in the archive."""
        if not isinstance(zinfo_or_arcname, ZipInfo):
            zinfo = ZipInfo(filename=zinfo_or_arcname,
                            date_time=time.localtime(time.time())[:6])
    
            zinfo.compress_type = self.compression
            zinfo.external_attr = 0600 << 16
        else:
            zinfo = zinfo_or_arcname
    
        if not self.fp:
            raise RuntimeError(
                  "Attempt to write to ZIP archive that was already closed")
    
        if compress_type is not None:
            zinfo.compress_type = compress_type
    
        zinfo.file_size = len(bytes)            # Uncompressed size
        zinfo.header_offset = self.fp.tell()    # Start of header bytes
        self._writecheck(zinfo)
        self._didModify = True
        zinfo.CRC = crc32(bytes) & 0xffffffff       # CRC-32 checksum
        if zinfo.compress_type == ZIP_DEFLATED:
            co = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION,
                 zlib.DEFLATED, -15)
            bytes = co.compress(bytes) + co.flush()
            zinfo.compress_size = len(bytes)    # Compressed size
        else:
            zinfo.compress_size = zinfo.file_size
        zinfo.header_offset = self.fp.tell()    # Start of header bytes
>       self.fp.write(zinfo.FileHeader())

/usr/lib/python2.7/zipfile.py:1099: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <zipfile.ZipInfo object at 0x89d932c>

    def FileHeader(self):
        """Return the per-file header as a string."""
        dt = self.date_time
        dosdate = (dt[0] - 1980) << 9 | dt[1] << 5 | dt[2]
        dostime = dt[3] << 11 | dt[4] << 5 | (dt[5] // 2)
        if self.flag_bits & 0x08:
            # Set these to zero because we write them after the file data
            CRC = compress_size = file_size = 0
        else:
            CRC = self.CRC
            compress_size = self.compress_size
            file_size = self.file_size
    
        extra = self.extra
    
        if file_size > ZIP64_LIMIT or compress_size > ZIP64_LIMIT:
            # File is larger than what fits into a 4 byte integer,
            # fall back to the ZIP64 extension
            fmt = '<HHQQ'
            extra = extra + struct.pack(fmt,
                    1, struct.calcsize(fmt)-4, file_size, compress_size)
            file_size = 0xffffffff
            compress_size = 0xffffffff
            self.extract_version = max(45, self.extract_version)
            self.create_version = max(45, self.extract_version)
    
        filename, flag_bits = self._encodeFilenameFlags()
        header = struct.pack(structFileHeader, stringFileHeader,
                 self.extract_version, self.reserved, flag_bits,
                 self.compress_type, dostime, dosdate, CRC,
                 compress_size, file_size,
>                len(filename), len(extra))
E       error: ushort format requires 0 <= number <= USHRT_MAX

/usr/lib/python2.7/zipfile.py:342: error

(!) above looks like a problem in python's stdlib zipfile.

TestNormalizePagename.testNormalizeWhitespace:

self = <MoinMoin._tests.test_wikiutil.TestNormalizePagename object at 0x8c5f4ac>

    def testNormalizeWhitespace(self):
        """ request: normalize pagename: normalize whitespace """
        cases = (
            (u'         ', u''),
            (u'    a', u'a'),
            (u'a    ', u'a'),
            (u'a     b     c', u'a b c'),
            (u'a   b  /  c    d  /  e   f', u'a b/c d/e f'),
            # All 30 unicode spaces
            (config.chars_spaces, u''),
            )
        for test, expected in cases:
            result = wikiutil.normalize_pagename(test, self.request.cfg)
>           assert result == expected
E           assert u'\u200b' == u''

MoinMoin/_tests/test_wikiutil.py:1005: AssertionError

(!) ok, this looks like something moin is responsible for.

TestExclusiveLock.testAcquireAfterTimeout:

self = <test_lock.TestExclusiveLock object at 0x9c5a18c>

    def testAcquireAfterTimeout(self):
        """ util.lock: ExclusiveLock: acquire after timeout
    
            Lock with one lock, try to acquire another after timeout.
            """
        timeout = 2.0 # minimal timout
        first = ExclusiveLock(self.lock_dir, timeout)
        second = ExclusiveLock(self.lock_dir, timeout)
        if not first.acquire(0.1):
            py.test.skip("can't acquire lock")
        if second.acquire(0.1):
            py.test.skip("first lock is not exclusive")
        # Second lock should be acquired after timeout
>       assert second.acquire(timeout + 0.1)
E       AssertionError: (assertion failed, but when it was re-run for printing intermediate values, it did not fail.  Suggestions: compute assert expression before the assert or use --no-assert)

MoinMoin/util/_tests/test_lock.py:121: AssertionError

Reproduction

TestRealCreation.testListCreate

Not reproduced, but apparently it's just warning, not error, because when running

make pagepacks

Somewhere in the output appears this:

2010-11-28 13:54:40,002 WARNING MoinMoin.log:111 /usr/lib/python2.6/zipfile.py:1111: DeprecationWarning: struct integer overflow masking is deprecated
2010-11-28 13:54:40,002 WARNING MoinMoin.log:111 /usr/lib/python2.6/zipfile.py:1111: DeprecationWarning: 'H' format requires 0 <= number <= 65535
2010-11-28 13:54:40,005 WARNING MoinMoin.log:111 /opt/moinmoin/1.9/MoinMoin/script/maint/mkpagepacks.py:126: DeprecationWarning: struct integer overflow masking is deprecated
2010-11-28 13:54:40,005 WARNING MoinMoin.log:111 /opt/moinmoin/1.9/MoinMoin/script/maint/mkpagepacks.py:126: DeprecationWarning: 'H' format requires 0 <= number <= 65535

'H' is ushort according to http://docs.python.org/library/struct.html#format-characters.

TestNormalizePagename.testNormalizeWhitespace

Cannot reproduce, although it's Python bug:

>>> c = u'\u200b'
>>> c.isspace()
False
>>> c = u'\u200B'
>>> c.isspace()
False

Python version:

Python 2.7 (r27:82500, Oct 20 2010, 03:21:03) 
[GCC 4.5.1] on linux2

Same in Python 2.6.6 works fine:

>>> c = u'\u200b'
>>> c.isspace()
True

TestExclusiveLock.testAcquireAfterTimeout

Not reproduced, but tested manually.

The test fails with line:

   1 assert second.acquire(timeout + 0.1)

Maybe it's because of my slow computer (but I don't complain of it).

   1 assert second.acquire(timeout + 0.2)

This works absolutely fine.

What doesn't work?


Clicking any button (Save, Preview, Text edit, Spelling except Cancel) from GUI editing (any editable page is affected) triggers error

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

2010-11-28 10:15:01,386 ERROR MoinMoin.wsgiapp:293 An exception has occurred [http://localhost:8080/buu%20uu%20u].
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 282, in __call__
    response = run(context)
  File "/usr/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 88, in run
    response = dispatch(request, context, action_name)
  File "/usr/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 136, in dispatch
    response = handle_action(context, pagename, action_name)
  File "/usr/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 195, in handle_action
    handler(context.page.page_name, context)
  File "/usr/lib/python2.7/site-packages/MoinMoin/action/edit.py", line 92, in execute
    savetext = convert(request, pagename, savetext)
  File "/usr/lib/python2.7/site-packages/MoinMoin/converter/text_html_text_moin_wiki.py", line 1454, in convert
    tree = parse(request, text)
  File "/usr/lib/python2.7/site-packages/MoinMoin/converter/text_html_text_moin_wiki.py", line 1432, in parse
    raise ConvertError('ExpatError: %s (see dump in %s)' % (msg, logname))
ConvertError: ExpatError: mismatched tag: line 379, column 8 (see dump in /opt/moinmoin/1.9-stable/wiki/data/expaterror.log)
2010-11-28 10:15:01,504 INFO MoinMoin.web.serving:41 127.0.0.1 "POST /buu%20uu%20u HTTP/1.1" 500 -
2010-11-28 10:15:01,519 ERROR werkzeug:106 Error on request:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/MoinMoin/support/werkzeug/serving.py", line 151, in run_wsgi
    execute(app)
  File "/usr/lib/python2.7/site-packages/MoinMoin/support/werkzeug/serving.py", line 138, in execute
    application_iter = app(environ, start_response)
  File "/usr/lib/python2.7/site-packages/MoinMoin/support/werkzeug/utils.py", line 248, in __call__
    return self.app(environ, start_response)
  File "/usr/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 282, in __call__
    response = run(context)
  File "/usr/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 88, in run
    response = dispatch(request, context, action_name)
  File "/usr/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 136, in dispatch
    response = handle_action(context, pagename, action_name)
  File "/usr/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 195, in handle_action
    handler(context.page.page_name, context)
  File "/usr/lib/python2.7/site-packages/MoinMoin/action/edit.py", line 92, in execute
    savetext = convert(request, pagename, savetext)
  File "/usr/lib/python2.7/site-packages/MoinMoin/converter/text_html_text_moin_wiki.py", line 1454, in convert
    tree = parse(request, text)
  File "/usr/lib/python2.7/site-packages/MoinMoin/converter/text_html_text_moin_wiki.py", line 1432, in parse
    raise ConvertError('ExpatError: %s (see dump in %s)' % (msg, logname))
ConvertError: ExpatError: mismatched tag: line 379, column 8 (see dump in /opt/moinmoin/1.9-stable/wiki/data/expaterror.log)

(buu%20uu%20u (buu uu u) is the page name.)

expaterror.log is attached.

(!) Is this a regression when using with python 2.7 or do you see this with 2.6 also?

→ it's not a regression, the same happens for me in Python2.6 (note: I use it in another machine)


Clicking load draft makes GUI (and text) editor load HTML tags

(!) Is this a regression when using with python 2.7 or do you see this with 2.6 also?

→ it's not a regression, the same happens for me in Python2.6


Uploading file with no extension as an attachment from Google Chrome web browser doesn't work

Message:

No file content. Delete non ASCII characters from the file name and try again.

Although this can be Google Chrome bug, because from Firefox everything works fine.

(!) The Chrome issue is is known (there is a bug report about it) - is this a regression when using with python 2.7 or do you see this with 2.6 also?

→ it's not a regression, the same happens for me in Python2.6


Everything else seems to work.

I haven't found anything which doesn't work.

MoinMoin: EasyToDo/test moin-1.9 current repo checkout with Python 2.7/Notes (last edited 2010-11-28 13:05:16 by PiotrBanaszkiewicz)