man-group / PyBloqs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unit test failure - No such file or directory: 'PyBloqs/pybloqs/static/highstock.js'

bmoscon opened this issue · comments

clean install of Pybloqs on a 2.7 environment. setup.py develop, Installed whkhtmltopdf and setup.py load_wkhtmltopdf --wkhtmltopdf=...

then setup.py test

there were 13 test failures, all with the same signature. Is there an non obvious step? The only thing I didn't do was install highcharts, since the readme indicated it was optional.

______________________________ test_scatter_plot _______________________________

    @wraps(func)
    def generate_and_check():
        # Generate the block
        block = func()
>       tmp_file = block.save(fmt=fmt, **kwargs)

tests/integration/generate/generation_framework.py:31: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pybloqs/block/base.py:175: in save
    content = self.render_html(static_output=False, header_block=header_block, footer_block=footer_block)
pybloqs/block/base.py:119: in render_html
    res.write(head)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pybloqs.static.JScript object at 0x7fbf3cccfc90>
parent = <head><script type="text/javascript">if(typeof(_pybloqs_load_sentinel_jsinflat... block;\n    margin-left: 1em;\n    font-family: monospace;\n}\n</style></head>

    def write(self, parent=None):
        stream = StringIO()
    
        # Write out init condition
        stream.write("if(typeof(%s) == 'undefined'){" % self._sentinel_var_name)
    
>       with open(self._local_path, "rb") as f:
E       IOError: [Errno 2] No such file or directory: '/home/bryant/PyBloqs/pybloqs/static/highstock.js'

pybloqs/static/__init__.py:70: IOError

Thank you very much for testing this!

The essential error seems to be "No such file or directory: highstock.js".
Please check if the highcharts js files are in pybloqs/static/

I assume they are not. In that case please post:

  1. the contents of the node_modules/highcharts directory (I assume you use npm to download highcharts),
  2. the full command that you used with load_highcharts
  3. the output of that command.
    Cheers.

Thanks for responding. HighCharts is NOT installed. It seems it must be? Per the documentation:

"HighCharts (optional; ... )"

I assumed it was 100% optional. It seems its only optional for normal use, but NOT optional to run the tests. Is this correct?

Well, to quote the README: "To create blocks with Highcharts plots, you need to download Highcharts separately" and the full functionality is tested. The tests could have a flag to check whether it is bare-bones install, but then the flag should probably be set by default to on and everyone doing development would need to know about it. So there are arguments for both sides.

The "HighCharts is optional" is from a user perspective. I hope that with CircleCI (which downloads and sets up HighCharts) running for forks the testing is easier.

ok, good to know. It makes sense. I had erroneously assumed that HighBlocks would supersede some other functionality, but this is not the case. Thanks for confirming!