Segfault-Inc / Multicorn

Data Access Library
https://multicorn.org/
PostgreSQL License
701 stars 145 forks source link

multicorn/fsfdw/test.py:365: AssertionError #128

Open df7cb opened 8 years ago

df7cb commented 8 years ago

Hi Ronan,

thanks for the testsuite fixes. I'm unfortunately still seeing an assertion error:

dh_auto_test --buildsystem=pybuild
I: pybuild base:184: cd /srv/projects/postgresql/multicorn/postgresql-multicorn/.pybuild/pythonX.Y_2.7/build; python2.7 -m pytest 
=============================== test session starts ================================
platform linux2 -- Python 2.7.11, pytest-2.8.5, py-1.4.31, pluggy-0.3.1
rootdir: /srv/projects/postgresql/multicorn/postgresql-multicorn, inifile: setup.cfg
collected 7 items 

multicorn/fsfdw/test.py F......

===================================== FAILURES =====================================
________________________________ test_docutils_meta ________________________________

    def wrapper():
        directory = tempfile.mkdtemp()
        try:
>           return function(directory)

multicorn/fsfdw/test.py:27: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

tempdir = '/home/cbe/tmp/tmppK0aze'

    @with_tempdir
    def test_docutils_meta(tempdir):
        def counting(filename):
            counting.n_calls += 1
            return extract_meta(filename)
        counting.n_calls = 0
        wrapper = mtime_lru_cache(counting, max_size=2)
        def extract(filename):
            return wrapper(os.path.join(tempdir, filename))
        rest_1 = '''
    The main title
    ==============

    Second title
    ------------

    :Author: Me

    Content
    '''
        meta_1 = {'title': 'The main title', 'subtitle': 'Second title',
                  'author': 'Me'}
        rest_2 = '''
    First title
    ===========

    :Author: Myself
    :Summary:
        Lorem ipsum
        dolor sit amet

    Not a subtitle
    --------------

    Content
    '''
        meta_2 = {'title': 'First title', 'author': 'Myself',
                  'summary': 'Lorem ipsum\ndolor sit amet'}
        def write(filename, content):
            with open(os.path.join(tempdir, filename), 'w') as file_obj:
                file_obj.write(content)
        write('first.rst', rest_1)
        write('second.rst', rest_2)
        assert counting.n_calls == 0
        assert extract('first.rst') == meta_1
        assert counting.n_calls == 1
        assert extract('first.rst') == meta_1  # cached
        assert counting.n_calls == 1
        assert extract('second.rst') == meta_2
        assert counting.n_calls == 2
        write('third.rst', rest_1)
        assert extract('third.rst') == meta_1  # Exceeds the cache size
        assert counting.n_calls == 3
        write('third.rst', rest_2)
>       assert extract('third.rst') == meta_2
E       assert {'author': 'M...e main title'} == {'author': 'My...'First title'}
E         Differing items:
E         {'title': 'The main title'} != {'title': 'First title'}
E         {'author': 'Me'} != {'author': 'Myself'}
E         Left contains more items:
E         {'subtitle': u'Second title'}
E         Right contains more items:
E         {'summary': 'Lorem ipsum\ndolor sit amet'}
E         Use -v to get the full diff

multicorn/fsfdw/test.py:365: AssertionError
============== 1 failed, 6 passed, 1 pytest-warnings in 0.43 seconds ===============
E: pybuild pybuild:274: test: plugin distutils failed with: exit code=1: cd /srv/projects/postgresql/multicorn/postgresql-multicorn/.pybuild/pythonX.Y_2.7/build; python2.7 -m pytest 
rdunklau commented 8 years ago

I can't reproduce it, even with the exact same versions used by your build system:

============================================================================================================================== test session starts ==============================================================================================================================
platform linux2 -- Python 2.7.11, pytest-2.8.5, py-1.4.31, pluggy-0.3.1
rootdir: /home/ro/projets/Multicorn, inifile: setup.cfg
collected 7 items 

lib.linux-x86_64-2.7/multicorn/fsfdw/test.py .......

================================================================================================================== 7 passed, 1 pytest-warnings in 0.20 seconds ==================================================================================================================
df7cb commented 8 years ago

Hmm, weird. Maybe I should simply stop running these tests and rely solely on the SQL tests on the installed extension...?