vmware-archive / sql_magic

Magic functions for using Jupyter Notebook with Apache Spark and a variety of SQL databases.
Apache License 2.0
172 stars 21 forks source link

Unable to run tests without (py)spark #2

Open cfperez opened 7 years ago

cfperez commented 7 years ago

Tests will not without spark installed.

❯❯❯ ./run_tests.sh                                                                           master ✱ ◼
========================================== test session starts ==========================================
platform linux -- Python 3.6.3, pytest-3.2.3, py-1.4.34, pluggy-0.4.0
rootdir: /home/cperez/repos/sql_magic, inifile: pytest.ini
collected 0 items / 1 errors

================================================ ERRORS =================================================
_________________________________ ERROR collecting tests/test_magic.py __________________________________
tests/test_magic.py:14: in <module>
    from utils import create_spark_conn
tests/utils.py:4: in <module>
    findspark.init()
venv/lib/python3.6/site-packages/findspark.py:134: in init
    py4j = glob(os.path.join(spark_python, 'lib', 'py4j-*.zip'))[0]
E   IndexError: list index out of range
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================== 1 error in 0.63 seconds ========================================
---------------------------------------------------------------------------                                                                                                                               [12/1216]
SystemExit                                Traceback (most recent call last)
~/ans/venv/lib/python3.6/runpy.py in run_module(mod_name, init_globals, run_name, alter_sys)
    203         run_name = mod_name
    204     if alter_sys:
--> 205         return _run_module_code(code, init_globals, run_name, mod_spec)
    206     else:
    207         # Leave the sys module alone

~/ans/venv/lib/python3.6/runpy.py in _run_module_code(code, init_globals, mod_name, mod_spec, pkg_name, script_name)
     94         mod_globals = temp_module.module.__dict__
     95         _run_code(code, mod_globals, init_globals,
---> 96                   mod_name, mod_spec, pkg_name, script_name)
     97     # Copy the globals of the temporary module, as they
     98     # may be cleared when the temporary module goes away

~/ans/venv/lib/python3.6/runpy.py in _run_code(code, run_globals, init_globals, mod_name, mod_spec, pkg_name, script_name)
     83                        __package__ = pkg_name,
     84                        __spec__ = mod_spec)
---> 85     exec(code, run_globals)
     86     return run_globals
     87
~/repos/sql_magic/venv/lib/python3.6/site-packages/pytest.py in <module>()
     71     # we trigger the below "else" condition by the following import
     72     import pytest
---> 73     raise SystemExit(pytest.main())
     74 else:
     75

SystemExit: 2
/home/cperez/repos/sql_magic/venv/lib/python3.6/site-packages/IPython/core/interactiveshell.py:2598: UserWarning: Unknown failure executing module: <pytest>
  warn('Unknown failure executing module: <%s>' % mod_name)
crawles commented 7 years ago

@cfperez thank you. I will try to reproduce

cfperez commented 7 years ago

Would it help if I provide script/code to repro?

On Wed, Oct 25, 2017, 8:27 AM Chris Rawles notifications@github.com wrote:

@cfperez https://github.com/cfperez thank you. I will try to reproduce

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pivotal/sql_magic/issues/2#issuecomment-339368797, or mute the thread https://github.com/notifications/unsubscribe-auth/AB64w2q_E1oPoz1spWTPKeifKrtuthHmks5sv1NsgaJpZM4P_joo .

crawles commented 7 years ago

Yes, please

cfperez commented 7 years ago

Note that sqlalchemy is a missing dependency in requirements.txt.

conda create -n sql_magic --file requirements.txt python=3 sqlalchemy
source activate sql_magic
./run_tests.sh