Skip to content
Permalink
Browse files

Disable failing tests for plugins (microdata, publication_list)

cc @ivanteoh — I don’t understand those tests and failures, so I can’t
fix them myself.

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jan 8, 2017
1 parent c1fd4c8 commit 773bcbfe99c083394b5750f948bd1af9bde4f83b
File renamed without changes.
File renamed without changes.

19 comments on commit 773bcbf

@ivanteoh

This comment has been minimized.

Copy link
Member

@ivanteoh ivanteoh replied Jan 8, 2017

I will have look them when I got a chance.

@xuhdev

This comment has been minimized.

Copy link
Member

@xuhdev xuhdev replied Jan 8, 2017

I got a very different error E TypeError: compile_html() got an unexpected keyword argument 'post' when running test_publication_list.

===================================== test session starts =====================================
platform linux -- Python 3.4.2, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
rootdir: /home/hong/src/nikola-plugins, inifile: 
collected 1 items

tests/test_publication_list.py F

========================================== FAILURES ===========================================
________________________________ TestPublication.test_default _________________________________

self = <tests.test_publication_list.TestPublication testMethod=test_default>

    def test_default(self):
        # the result should be
        expected = (
            '<div class="publication-list">'
            '<h3>2015</h3><ul>'
            '<li class="publication".*>.*One article in 2015.*<a href="https://example.com/bibtex/a2015.bib">BibTeX</a>.*<a href="/pdf/a2015.pdf">full text</a>.*<a href="https://example.com/papers/a2015.html">abstract and details</a>.*</li>'
            '<li class="publication".*>.*One conference in 2015.*<a href="https://example.com/bibtex/p2015.bib">BibTeX</a>.*<a href="https://example.com/papers/p2015.html">abstract and details</a>.*</li>'
            '</ul><h3>2010</h3><ul>'
            '<li class="publication".*>.*One Book in 2010.*<a href="https://example.com/bibtex/b2010.bib">BibTeX</a>.*<a href="http://example.org/b2010.pdf">full text</a>.*<a href="https://example.com/papers/b2010.html">abstract and details</a>.*</li>'
            '</ul></div>'
        )
        self.sample = '.. publication_list:: tests/data/publication_list/test.bib\n\t:highlight_author: Nikola Tesla'
        self.deps = 'tests/data/publication_list/test.bib'
>       self.basic_test()

tests/test_publication_list.py:42: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_rst_compiler.py:78: in basic_test
    self.setHtmlFromRst(self.sample)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <tests.test_publication_list.TestPublication testMethod=test_default>
rst = '.. publication_list:: tests/data/publication_list/test.bib\n\t:highlight_author: Nikola Tesla'

    def setHtmlFromRst(self, rst):
        """ Create html output from rst string """
        tmpdir = tempfile.mkdtemp()
        inf = os.path.join(tmpdir, 'inf')
        outf = os.path.join(tmpdir, 'outf')
        depf = os.path.join(tmpdir, 'outf.dep')
        with io.open(inf, 'w+', encoding='utf8') as f:
            f.write(rst)
        p = Post(inf, self.site.config, outf, False, None, '', self.compiler)
        self.site.post_per_input_file[inf] = p
>       p.compile_html(inf, outf, post=p)
E       TypeError: compile_html() got an unexpected keyword argument 'post'

tests/test_rst_compiler.py:90: TypeError
------------------------------------ Captured stderr setup ------------------------------------
[2017-01-08T23:42:50Z] NOTICE: Nikola: --- TESTS FOR publication_list
------------------------------------ Captured stderr call -------------------------------------
Scanning posts..done!
---------------------------------- Captured stdout teardown -----------------------------------

---------------------------------- Captured stderr teardown -----------------------------------
[2017-01-08T23:42:50Z] NOTICE: Nikola: --- END OF TESTS FOR publication_list
================================== 1 failed in 0.51 seconds ===================================

@felixfontein

This comment has been minimized.

Copy link
Contributor

@felixfontein felixfontein replied Jan 9, 2017

@xuhdev: p.compile_html is an alias for PageCompiler.compile, whose signature is compile(self, source, dest, is_two_file=True, post=None, lang=None). Maybe you have an older version of Nikola running where p.compile_html was still an alias for PageCompiler.compile_html, whose signature is compile_html(self, source, dest, is_two_file=True) (which doesn't expect post)?

@felixfontein

This comment has been minimized.

Copy link
Contributor

@felixfontein felixfontein replied Jan 9, 2017

The strange internal errors in pytest for publication list seem to be caused by a bad design decision in pybtex: they define __eq__ for their exception class, but not __hash__. That's pretty annoying. A simple

    def __hash__(self):
        return hash(unicode(self))

would have been enough. (Adding that to a local installation should at least allow to get a better error message for the failing tests...)

@xuhdev

This comment has been minimized.

Copy link
Member

@xuhdev xuhdev replied Jan 9, 2017

@felixfontein Would you mind reporting it to the pybtex issue tracker? I can increase the pybtex minimum requirement for the plugin when it gets into a newer version.

@felixfontein

This comment has been minimized.

Copy link
Contributor

@felixfontein felixfontein replied Jan 9, 2017

@xuhdev: if you have an account there, feel free to report that issue yourself. If not, I might do that somewhen later... (I don't have an account there yet.)

@xuhdev

This comment has been minimized.

@felixfontein

This comment has been minimized.

Copy link
Contributor

@felixfontein felixfontein replied Jan 9, 2017

Thanks!

@xuhdev

This comment has been minimized.

Copy link
Member

@xuhdev xuhdev replied Jan 9, 2017

@felixfontein It's fixed now.

@xuhdev

This comment has been minimized.

Copy link
Member

@xuhdev xuhdev replied Feb 28, 2017

@felixfontein Shall we re-enable the tests? A new version of "pybtex" has been released with this fix.

@felixfontein

This comment has been minimized.

Copy link
Contributor

@felixfontein felixfontein replied Feb 28, 2017

If the tests now don't fail anymore, sure, why not?
@Kwpolska: do you agree?

@Kwpolska

This comment has been minimized.

Copy link
Member Author

@Kwpolska Kwpolska replied Feb 28, 2017

@xuhdev If those tests succeed, feel free to move them back to tests/ and send a PR with that.

@ivanteoh

This comment has been minimized.

Copy link
Member

@ivanteoh ivanteoh replied Mar 7, 2017

Now test_publication_list has different error message. Refer to https://travis-ci.org/getnikola/plugins/jobs/208555526. I don't understand much about publication list plugin. I will leave it to the author to resolve the issue.

tests/test_publication_list.py F

===================================================================== FAILURES ======================================================================
___________________________________________________________ TestPublication.test_default ____________________________________________________________

opener = <built-in function open>, filename_or_file = 'output/bibtex/a2015.bib', mode = 'w', kwargs = {'encoding': 'UTF-8'}
filename = 'output/bibtex/a2015.bib', write_mode = True

    def _open(opener, filename_or_file, mode, **kwargs):
        if hasattr(filename_or_file, 'read') and hasattr(filename_or_file, 'close'):
            return filename_or_file
        else:
            filename = filename_or_file
        write_mode = 'w' in mode
        try:
            if write_mode:
>               return _open_or_create(opener, filename, mode, environ, **kwargs)

../../lib/python3.4/site-packages/pybtex/io.py:73:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

opener = <built-in function open>, filename = 'output/bibtex/a2015.bib', mode = 'w'
environ = environ({'NIKOLA_LOCALE_OTHER': 'pl,pl_PL.utf8', 'DISPLAY': '/private/tmp/com.apple.launchd.cuFXJZLg3S/org.macosforge....Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man'})
kwargs = {'encoding': 'UTF-8'}

    def _open_or_create(opener, filename, mode, environ, **kwargs):
        try:
            return opener(filename, mode, **kwargs)
        except EnvironmentError as error:
            if 'TEXMFOUTPUT' in environ:
                new_filename = path.join(environ['TEXMFOUTPUT'], filename)
                try:
                    return opener(new_filename, mode, **kwargs)
                except EnvironmentError:
                    pass
>           raise error

../../lib/python3.4/site-packages/pybtex/io.py:62:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

opener = <built-in function open>, filename = 'output/bibtex/a2015.bib', mode = 'w'
environ = environ({'NIKOLA_LOCALE_OTHER': 'pl,pl_PL.utf8', 'DISPLAY': '/private/tmp/com.apple.launchd.cuFXJZLg3S/org.macosforge....Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man'})
kwargs = {'encoding': 'UTF-8'}

    def _open_or_create(opener, filename, mode, environ, **kwargs):
        try:
>           return opener(filename, mode, **kwargs)
E           FileNotFoundError: [Errno 2] No such file or directory: 'output/bibtex/a2015.bib'

../../lib/python3.4/site-packages/pybtex/io.py:54: FileNotFoundError

During handling of the above exception, another exception occurred:

self = <tests.test_publication_list.TestPublication testMethod=test_default>

    def test_default(self):
        # the result should be
        expected = (
            '<div class="publication-list">'
            '<h3>2015</h3><ul>'
            '<li class="publication".*>.*One article in 2015.*<a href="https://example.com/papers/a2015.html">details</a>.*<a href="/pdf/a2015.pdf">full text</a>.*</li>'
            '<li class="publication".*>.*One conference in 2015.*<a href="https://example.com/papers/p2015.html">details</a>.*</li>'
            '</ul><h3>2010</h3><ul>'
            '<li class="publication".*>.*One Book in 2010.*<a href="https://example.com/papers/b2010.html">details</a>.*<a href="http://example.org/b2010.pdf">full text</a>.*</li>'
            '</ul></div>'
        )
        self.sample = '.. publication_list:: tests/data/publication_list/test.bib\n\t:highlight_author: Nikola Tesla'
        self.deps = 'tests/data/publication_list/test.bib'
>       self.basic_test()

tests/test_publication_list.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_rst_compiler.py:78: in basic_test
    self.setHtmlFromRst(self.sample)
tests/test_rst_compiler.py:90: in setHtmlFromRst
    p.compile_html(inf, outf, post=p)
../nikola/nikola/plugins/compile/rest/__init__.py:106: in compile
    output, error_level, deps, shortcode_deps = self.compile_string(data, source, is_two_file)
../nikola/nikola/plugins/compile/rest/__init__.py:86: in compile_string
    no_title_transform=self.site.config.get('NO_DOCUTILS_TITLE_TRANSFORM', False))
../nikola/nikola/plugins/compile/rest/__init__.py:297: in rst2html
    pub.publish(enable_exit_status=enable_exit_status)
../../lib/python3.4/site-packages/docutils/core.py:217: in publish
    self.settings)
../../lib/python3.4/site-packages/docutils/readers/__init__.py:72: in read
    self.parse()
../../lib/python3.4/site-packages/docutils/readers/__init__.py:78: in parse
    self.parser.parse(self.input, document)
../../lib/python3.4/site-packages/docutils/parsers/rst/__init__.py:185: in parse
    self.statemachine.run(inputlines, document, inliner=self.inliner)
../../lib/python3.4/site-packages/docutils/parsers/rst/states.py:170: in run
    input_source=document['source'])
../../lib/python3.4/site-packages/docutils/statemachine.py:239: in run
    context, state, transitions)
../../lib/python3.4/site-packages/docutils/statemachine.py:460: in check_line
    return method(match, context, next_state)
../../lib/python3.4/site-packages/docutils/parsers/rst/states.py:2318: in explicit_markup
    nodelist, blank_finish = self.explicit_construct(match)
../../lib/python3.4/site-packages/docutils/parsers/rst/states.py:2330: in explicit_construct
    return method(self, expmatch)
../../lib/python3.4/site-packages/docutils/parsers/rst/states.py:2073: in directive
    directive_class, match, type_name, option_presets)
../../lib/python3.4/site-packages/docutils/parsers/rst/states.py:2122: in run_directive
    result = directive_instance.run()
v7/publication_list/publication_list.py:174: in run
    bib_data.to_file('/'.join([self.output_folder, bib_link]), 'bibtex')
../../lib/python3.4/site-packages/pybtex/database/__init__.py:308: in to_file
    return writer.write_file(self, file)
../../lib/python3.4/site-packages/pybtex/database/output/__init__.py:38: in write_file
    with open_file(filename, mode, encoding=self.encoding) as stream:
../../lib/python3.4/site-packages/pybtex/io.py:87: in open_unicode
    return _open(io.open, filename, mode, encoding=encoding)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

opener = <built-in function open>, filename_or_file = 'output/bibtex/a2015.bib', mode = 'w', kwargs = {'encoding': 'UTF-8'}
filename = 'output/bibtex/a2015.bib', write_mode = True

    def _open(opener, filename_or_file, mode, **kwargs):
        if hasattr(filename_or_file, 'read') and hasattr(filename_or_file, 'close'):
            return filename_or_file
        else:
            filename = filename_or_file
        write_mode = 'w' in mode
        try:
            if write_mode:
                return _open_or_create(opener, filename, mode, environ, **kwargs)
            else:
                return _open_existing(opener, filename, mode, locate=kpsewhich, **kwargs)
        except EnvironmentError as error:
>           raise PybtexError("unable to open %s. %s" % (filename, error.strerror))
E           pybtex.exceptions.PybtexError: unable to open output/bibtex/a2015.bib. No such file or directory

../../lib/python3.4/site-packages/pybtex/io.py:77: PybtexError
@xuhdev

This comment has been minimized.

Copy link
Member

@xuhdev xuhdev replied Mar 8, 2017

I don't quite understand. It seems that somehow the plugin does not have the permission to create the file output/bibtex/a2015.bib in the testing environment. Can you help me solving that issue? It works well in my setup.

@ivanteoh

This comment has been minimized.

Copy link
Member

@ivanteoh ivanteoh replied Mar 8, 2017

@xuhdev it fails in my local setup. What OS is in your setup?

@xuhdev

This comment has been minimized.

Copy link
Member

@xuhdev xuhdev replied Mar 8, 2017

@ivanteoh I'm on Debian.

@xuhdev

This comment has been minimized.

Copy link
Member

@xuhdev xuhdev replied Mar 8, 2017

@ivanteoh If you create a dir output, the test will pass.

@ivanteoh

This comment has been minimized.

Copy link
Member

@ivanteoh ivanteoh replied Mar 8, 2017

@xuhdev

Should use os.makedirs instead of os. mkdir on

        if bibtex_dir:  # create the bibtex dir if the option is set
            try:
                os.makedirs(os.path.sep.join((self.output_folder, bibtex_dir)))
            except OSError:  # probably because the dir already exists
                pass

        if detail_page_dir:  # create the detail page dir if the option is set
            try:
                os.makedirs(os.path.sep.join((self.output_folder, detail_page_dir)))
            except OSError:  # probably because the dir already exists
                pass

Because os.makedirs will create both output and bibtex folders, refer to https://docs.python.org/2/library/os.html.

Do you want me to update the code and pull request with my code?

@ivanteoh

This comment has been minimized.

Copy link
Member

@ivanteoh ivanteoh replied Mar 8, 2017

Pull request on #215

Please sign in to comment.
You can’t perform that action at this time.