daizutabi/pheasant

mkdocs with pheasant builds fine but can't serve

pkestene opened this issue · 3 comments

I'm using python 3.8, mkdocs 1.1 and pheasant tag 2.5.4

If I try to build site for tests/docs inside pheasant source directory, it's ok:

>>> mkdocs build
INFO    -  [Pheasant] Converter created. 
INFO    -  [Pheasant] Converter configured. 
INFO    -  Cleaning site directory 
INFO    -  Building documentation to directory: /data/pkestene/install/python/pheasant/tests/docs/site 
INFO    -  [Pheasant] Converting 14 pages. 
[12/12][=========================] [1/14]docs/index.md [23:27:00]                                                       
[08/08][=========================] [2/14]docs/main.md [23:27:00]                                                       
[10/10][=========================] [3/14]docs/test.md [23:27:00]                                                       
[01/01][=========================] [4/14]docs/conftest.py [23:27:00]                                              

but then if I want to serve:

>>> mkdocs serve
INFO    -  Building documentation... 
INFO    -  [Pheasant] Converter created. 
INFO    -  [Pheasant] Converter configured. 
INFO    -  Cleaning site directory 
INFO    -  [Pheasant] Converting 14 pages. 
[12/12][=========================] [1/14]docs/index.md [23:27:09]                                                       
[08/08][=========================] [2/14]docs/main.md [23:27:09]                                                       
[10/10][=========================] [3/14]docs/test.md [23:27:09]                                                       
[01/01][=========================] [4/14]docs/conftest.py [23:27:09]                                              
INFO    -  [Pheasant] Conversion finished. Elapsed time: 1.75s 
INFO    -  Documentation built in 1.83 seconds 
Traceback (most recent call last):
  File "/home/pkestene/local/miniconda3/envs/eclairs/bin/mkdocs", line 10, in <module>
    sys.exit(cli())
  File "/home/pkestene/local/miniconda3/envs/eclairs/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/pkestene/local/miniconda3/envs/eclairs/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/pkestene/local/miniconda3/envs/eclairs/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/pkestene/local/miniconda3/envs/eclairs/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/pkestene/local/miniconda3/envs/eclairs/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/pkestene/local/miniconda3/envs/eclairs/lib/python3.8/site-packages/mkdocs/__main__.py", line 140, in serve_command
    serve.serve(
  File "/home/pkestene/local/miniconda3/envs/eclairs/lib/python3.8/site-packages/mkdocs/commands/serve.py", line 146, in serve
    _livereload(host, port, config, builder, site_dir)
  File "/home/pkestene/local/miniconda3/envs/eclairs/lib/python3.8/site-packages/mkdocs/commands/serve.py", line 76, in _livereload
    server = config['plugins'].run_event('serve', server, config=config)
  File "/home/pkestene/local/miniconda3/envs/eclairs/lib/python3.8/site-packages/mkdocs/plugins.py", line 94, in run_event
    result = method(item, **kwargs)
TypeError: on_serve() missing 1 required positional argument: 'builder'
Shutting down kernel [python3]...Done.

I don't known if the problem is inside mkdocs itself or in pheasant. Do you have any idea ?

by the way, if I try to run pytest, one test is failing :

======================================================================== test session starts ========================================================================
platform linux -- Python 3.8.3, pytest-5.4.1, py-1.8.1, pluggy-0.13.1 -- /home/pkestene/local/miniconda3/envs/eclairs/bin/python
...
tests/core/test_core_name.py::test_rename_pattern PASSED                                                                                                      [ 11%]
tests/core/test_core_page.py::test_pages FAILED                                                                                                               [ 11%]Coverage.py warning: No data was collected. (no-data-collected)


============================================================================= FAILURES ==============================================================================
____________________________________________________________________________ test_pages _____________________________________________________________________________

    def test_pages():
        paths = [os.path.normpath(os.path.join(pheasant.__file__, "../../tests/docs/docs"))]
        pages = Pages(paths, "py,md")
        pages.collect()
    
>       d = pages[0].to_dict()

tests/core/test_core_page.py:12: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = Pages(paths=['/home/pkestene/.local/lib/python3.8/site-packages/pheasant-2.5.4-py3.8.egg/tests/docs/docs'], ext='py,md', _pages=[]), index = 0

    def __getitem__(self, index):
>       return self._pages[index]
E       IndexError: list index out of range

/home/pkestene/.local/lib/python3.8/site-packages/pheasant-2.5.4-py3.8.egg/pheasant/core/page.py:112: IndexError

Hi,

MkDocs changed its plugin signature in Version 1.1.1, so please update MkDocs to Version 1.1.1 or later, if possible.

I'm nor sure about Pytest failing but at least on Travis, the test was passed here (Python 3.8/Linux)

ok, thank you.

  • with mkdocs 1.1.1 it's ok; I don't see any requiment upon mkdocs >= 1.1.1 in pheasant sources, maybe it could be added ?
  • the unit test is still failing...