Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some problems in run_tests.sh #2196

Closed
asdf2014 opened this issue Feb 17, 2017 · 11 comments
Closed

some problems in run_tests.sh #2196

asdf2014 opened this issue Feb 17, 2017 · 11 comments

Comments

@asdf2014
Copy link
Member

superset==0.15.4

(env) [root@superset code]# bash run_tests.sh

rm: cannot remove `/root/.superset/unittests.db\r': No such file or directory
rm: cannot remove `/root/.superset/celerydb.sqlite\r': No such file or directory
rm: cannot remove `/root/.superset/celery_results.sqlite\r': No such file or directory
: invalid optionne 8: set: -
set: usage: set [--abefhkmnptuvxBCHP] [-o option-name] [arg ...]
Traceback (most recent call last):
  File "/root/env/bin/superset", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/root/env/code/superset/bin/superset", line 11, in <module>
    from superset.cli import manager
  File "/root/env/code/superset/__init__.py", line 25, in <module>
    app.config.from_object(CONFIG_MODULE)
  File "/root/env/lib/python2.7/site-packages/Flask-0.12-py2.7.egg/flask/config.py", line 168, in from_object
    obj = import_string(obj)
  File "/root/env/lib/python2.7/site-packages/Werkzeug-0.11.10-py2.7.egg/werkzeug/utils.py", line 443, in import_string
    sys.exc_info()[2])
  File "/root/env/lib/python2.7/site-packages/Werkzeug-0.11.10-py2.7.egg/werkzeug/utils.py", line 436, in import_string
    raise ImportError(e)
werkzeug.utils.ImportStringError: import_string() failed for 'tests.superset_test_config\r'. Possible reasons are:

- missing __init__.py in a package;
- package or module path not included in sys.path;
- duplicated package or module name taking precedence in sys.path;
- missing module, class, function or variable;

Debugged import:

- 'tests' found in '/root/env/code/tests/__init__.pyc'.
- 'tests.superset_test_config\r' not found.

Original exception:

'mportError: 'module' object has no attribute 'superset_test_config
Traceback (most recent call last):
  File "/root/env/bin/superset", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/root/env/code/superset/bin/superset", line 11, in <module>
    from superset.cli import manager
  File "/root/env/code/superset/__init__.py", line 25, in <module>
    app.config.from_object(CONFIG_MODULE)
  File "/root/env/lib/python2.7/site-packages/Flask-0.12-py2.7.egg/flask/config.py", line 168, in from_object
    obj = import_string(obj)
  File "/root/env/lib/python2.7/site-packages/Werkzeug-0.11.10-py2.7.egg/werkzeug/utils.py", line 443, in import_string
    sys.exc_info()[2])
  File "/root/env/lib/python2.7/site-packages/Werkzeug-0.11.10-py2.7.egg/werkzeug/utils.py", line 436, in import_string
    raise ImportError(e)
werkzeug.utils.ImportStringError: import_string() failed for 'tests.superset_test_config\r'. Possible reasons are:

- missing __init__.py in a package;
- package or module path not included in sys.path;
- duplicated package or module name taking precedence in sys.path;
- missing module, class, function or variable;

Debugged import:

- 'tests' found in '/root/env/code/tests/__init__.pyc'.
- 'tests.superset_test_config\r' not found.

Original exception:

'mportError: 'module' object has no attribute 'superset_test_config
Traceback (most recent call last):
  File "/root/env/bin/superset", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/root/env/code/superset/bin/superset", line 11, in <module>
    from superset.cli import manager
  File "/root/env/code/superset/__init__.py", line 25, in <module>
    app.config.from_object(CONFIG_MODULE)
  File "/root/env/lib/python2.7/site-packages/Flask-0.12-py2.7.egg/flask/config.py", line 168, in from_object
    obj = import_string(obj)
  File "/root/env/lib/python2.7/site-packages/Werkzeug-0.11.10-py2.7.egg/werkzeug/utils.py", line 443, in import_string
    sys.exc_info()[2])
  File "/root/env/lib/python2.7/site-packages/Werkzeug-0.11.10-py2.7.egg/werkzeug/utils.py", line 436, in import_string
    raise ImportError(e)
werkzeug.utils.ImportStringError: import_string() failed for 'tests.superset_test_config\r'. Possible reasons are:

- missing __init__.py in a package;
- package or module path not included in sys.path;
- duplicated package or module name taking precedence in sys.path;
- missing module, class, function or variable;

Debugged import:

- 'tests' found in '/root/env/code/tests/__init__.pyc'.
- 'tests.superset_test_config\r' not found.

Original exception:

'mportError: 'module' object has no attribute 'superset_test_config
-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-
VERSION: 0.15.4
GIT SHA: 1edc2b91cf15f669097939c36c6bc8acef5b5913
-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-
'nvalid command name 'nosetests
: command not found13: coveralls

@asdf2014
Copy link
Member Author

Just run python setup.py nosetests command, got the issues:

-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-
VERSION: 0.15.4
GIT SHA: 1edc2b91cf15f669097939c36c6bc8acef5b5913
-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

@asdf2014
Copy link
Member Author

asdf2014 commented Feb 17, 2017

(env) [root@superset code]# which python
/root/env/bin/python
(env) [root@superset code]# python -V
Python 2.7.12

@xrmx
Copy link
Contributor

xrmx commented Feb 17, 2017

It looks like you don't have nose installed but this hunk

: invalid optionne 8: set: -
set: usage: set [--abefhkmnptuvxBCHP] [-o option-name] [arg ...]

makes me think that you lost the the e in set -e

@asdf2014
Copy link
Member Author

I don't understand... The set -e command just to keep those following commands running safely, why i should worry about it?

(env) [root@superset code]# cat run_tests.sh

#!/usr/bin/env bash
echo $DB
rm ~/.superset/unittests.db
rm ~/.superset/celerydb.sqlite
rm ~/.superset/celery_results.sqlite
rm -f .coverage
export SUPERSET_CONFIG=tests.superset_test_config
set -e
superset/bin/superset db upgrade
superset/bin/superset db upgrade  # running twice on purpose as a test
superset/bin/superset version -v
python setup.py nosetests
coveralls

@asdf2014
Copy link
Member Author

asdf2014 commented Feb 17, 2017

@xrmx Please tell how to install nose, cuz i find nothing in CONTRIBUTING.md :-(

(env) [root@superset env]# uname -a
Linux edeppreapp01 2.6.32-279.el6_sn.7.x86_64 #1 SMP Fri May 27 18:04:25 CST 2016 x86_64 x86_64 x86_64 GNU/Linux

By the way, the CONTRIBUTING.md is suit for MAC OS, should we add some contents for other system, like CentOS, Ubuntu etc?

@xrmx
Copy link
Contributor

xrmx commented Feb 17, 2017

Ah! You have to run tests with "./run_tests.sh" not calling "bash run_tests.sh"

@asdf2014
Copy link
Member Author

I see, but i got the issues when i run ./run_tests.sh:

image

@xrmx
Copy link
Contributor

xrmx commented Feb 17, 2017

Please add some prints to understand what are you missing.

@asdf2014
Copy link
Member Author

Okey...

@rhunwicks
Copy link
Contributor

On a fresh install I get the same as @asdf2014 originally reported: when I run ./run_tests.sh I get:

ImportError: module 'tests' has no attribute 'superset_test_config'

In my case the problem was that the application source directory isn't on the Python path so when you run run_tests.sh it can't locate module tests. It works for me if I do

export PYTHONPATH=.
./run_tests.sh

@asdf2014
Copy link
Member Author

@rhunwicks Thanks a lot! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants