UMBC-CMSC447-Spring2017-Team5 / college-JUMP

https://lassa.xen.prgmr.com/collegejump/
GNU General Public License v3.0
0 stars 0 forks source link

Tests cause internal server error #78

Closed alexander-bauer closed 7 years ago

alexander-bauer commented 7 years ago

Running the test suite yields

➜  college-JUMP make test                                                                               [master] 
env/bin/python3 setup.py test
running test
Searching for pylint-flask
Best match: pylint-flask 0.5
Processing pylint_flask-0.5-py3.6.egg

Using /home/sasha/umbc/2017spring/cmsc447/college-JUMP/.eggs/pylint_flask-0.5-py3.6.egg
Searching for pytest-pylint
Best match: pytest-pylint 0.7.1
Processing pytest_pylint-0.7.1-py3.6.egg

Using /home/sasha/umbc/2017spring/cmsc447/college-JUMP/.eggs/pytest_pylint-0.7.1-py3.6.egg
Searching for pytest
Best match: pytest 3.0.7
Processing pytest-3.0.7-py3.6.egg

Using /home/sasha/umbc/2017spring/cmsc447/college-JUMP/.eggs/pytest-3.0.7-py3.6.egg
Searching for astroid>=1.0
Best match: astroid 1.5.1
Processing astroid-1.5.1-py3.6.egg

Using /home/sasha/umbc/2017spring/cmsc447/college-JUMP/.eggs/astroid-1.5.1-py3.6.egg
Searching for pylint>=1.0
Best match: pylint 1.7.0
Processing pylint-1.7.0-py3.6.egg

Using /home/sasha/umbc/2017spring/cmsc447/college-JUMP/.eggs/pylint-1.7.0-py3.6.egg
Searching for pylint-plugin-utils>=0.2.1
Best match: pylint-plugin-utils 0.2.6
Processing pylint_plugin_utils-0.2.6-py3.6.egg

Using /home/sasha/umbc/2017spring/cmsc447/college-JUMP/.eggs/pylint_plugin_utils-0.2.6-py3.6.egg
Searching for py>=1.4.29
Best match: py 1.4.33
Processing py-1.4.33-py3.6.egg

Using /home/sasha/umbc/2017spring/cmsc447/college-JUMP/.eggs/py-1.4.33-py3.6.egg
Searching for wrapt
Best match: wrapt 1.10.10
Processing wrapt-1.10.10-py3.6-linux-x86_64.egg

Using /home/sasha/umbc/2017spring/cmsc447/college-JUMP/.eggs/wrapt-1.10.10-py3.6-linux-x86_64.egg
Searching for lazy_object_proxy
Best match: lazy-object-proxy 1.2.2
Processing lazy_object_proxy-1.2.2-py3.6-linux-x86_64.egg

Using /home/sasha/umbc/2017spring/cmsc447/college-JUMP/.eggs/lazy_object_proxy-1.2.2-py3.6-linux-x86_64.egg
Searching for editdistance
Best match: editdistance 0.3.1
Processing editdistance-0.3.1-py3.6-linux-x86_64.egg

Using /home/sasha/umbc/2017spring/cmsc447/college-JUMP/.eggs/editdistance-0.3.1-py3.6-linux-x86_64.egg
Searching for mccabe
Best match: mccabe 0.6.1
Processing mccabe-0.6.1-py3.6.egg

Using /home/sasha/umbc/2017spring/cmsc447/college-JUMP/.eggs/mccabe-0.6.1-py3.6.egg
Searching for isort>=4.2.5
Best match: isort 4.2.5
Processing isort-4.2.5-py3.6.egg

Using /home/sasha/umbc/2017spring/cmsc447/college-JUMP/.eggs/isort-4.2.5-py3.6.egg
running egg_info
writing College_JUMP_Website.egg-info/PKG-INFO
writing dependency_links to College_JUMP_Website.egg-info/dependency_links.txt
writing requirements to College_JUMP_Website.egg-info/requires.txt
writing top-level names to College_JUMP_Website.egg-info/top_level.txt
reading manifest file 'College_JUMP_Website.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'College_JUMP_Website.egg-info/SOURCES.txt'
running build_ext
============================================== test session starts ===============================================
platform linux -- Python 3.6.0, pytest-3.0.7, py-1.4.33, pluggy-0.4.0
rootdir: /home/sasha/umbc/2017spring/cmsc447/college-JUMP, inifile:
plugins: pylint-0.7.1
collected 10 items 
-----------------------------------------------------------------
Linting files
-----------------------------------------------------------------

collegejump/__init__.py .
collegejump/__main__.py .
collegejump/database.py .
collegejump/forms.py F
collegejump/models.py .
collegejump/scmtools.py .
collegejump/views.py F
collegejump/test/test_app.py .FF

--------------- generated xml file: /home/sasha/umbc/2017spring/cmsc447/college-JUMP/coverage.xml ----------------
==================================================== FAILURES ====================================================
_________________________________________ [pylint] collegejump/forms.py __________________________________________
C: 40, 0: Wrong continued indentation (add 24 spaces).
        default=u'New Week Header')
        ^                       | (bad-continuation)
C: 44, 0: Wrong continued indentation (add 23 spaces).
        default=u'New Week Intro' )
        ^                      | (bad-continuation)
C: 44, 0: No space allowed before bracket
        default=u'New Week Intro' )
                                  ^ (bad-whitespace)
_________________________________________ [pylint] collegejump/views.py __________________________________________
C:189, 0: No space allowed before :
                                      form.add_week.data is True) :
                                                                  ^ (bad-whitespace)
________________________________________ TestCollegeJUMP.test_http_index _________________________________________

self = <test_app.TestCollegeJUMP object at 0x7f6d644157f0>
collegejump = <module 'collegejump' from '/home/sasha/umbc/2017spring/cmsc447/college-JUMP/collegejump/__init__.py'>
app = <FlaskClient <Flask 'collegejump'>>

    def test_http_index(self, collegejump, app):
        base_url = '/'
        d = open(debug_f, 'a')
        x = app.get(base_url)
        d.write("test_http_index\n")
        d.write(str(x))
        d.close()
>       assert(x.status_code == 301)
E       assert 500 == 301
E        +  where 500 = <Response streamed [500 INTERNAL SERVER ERROR]>.status_code

collegejump/test/test_app.py:38: AssertionError
---------------------------------------------- Captured stderr call ----------------------------------------------
[2017-05-01 09:41:41,296] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: no such table: announcement

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/collegejump/views.py", line 20, in front_page
    announcements=announcements)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/templating.py", line 134, in render_template
    context, ctx.app)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/templating.py", line 116, in _render
    rv = template.render(context)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 76, in render
    return original_render(self, *args, **kwargs)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/collegejump/templates/index.html", line 1, in top-level template code
    {% extends "theme.html" %}
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/collegejump/templates/theme.html", line 1, in top-level template code
    {% extends "bootstrap/base.html" %}
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask_bootstrap/templates/bootstrap/base.html", line 1, in top-level template code
    {% block doc -%}
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask_bootstrap/templates/bootstrap/base.html", line 4, in block "doc"
    {%- block html %}
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask_bootstrap/templates/bootstrap/base.html", line 20, in block "html"
    {% block body -%}
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/collegejump/templates/theme.html", line 91, in block "body"
    {% block content -%}
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/collegejump/templates/index.html", line 46, in block "content"
    {% for announcement in announcements %}
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2855, in __iter__
    return self._execute_and_instances(context)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2878, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 945, in execute
    return meth(self, multiparams, params)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
    context)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
    exc_info
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
    raise value.with_traceback(tb)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: announcement [SQL: 'SELECT announcement.id AS announcement_id, announcement.title AS announcement_title, announcement.content AS announcement_content, announcement.timestamp AS announcement_timestamp, announcement.author_id AS announcement_author_id \nFROM announcement ORDER BY announcement.timestamp DESC\n LIMIT ? OFFSET ?'] [parameters: (10, 0)]
_________________________________________ TestCollegeJUMP.test_http_site _________________________________________

self = <test_app.TestCollegeJUMP object at 0x7f6d64292550>
collegejump = <module 'collegejump' from '/home/sasha/umbc/2017spring/cmsc447/college-JUMP/collegejump/__init__.py'>
app = <FlaskClient <Flask 'collegejump'>>

    def test_http_site(self, collegejump, app):
        d = open(debug_f, 'a')
        d.write("test_http_site\n")
        #add urls here as needed
        url_list = ['announcement/', 'calendar']
        base_url = '/'
        for u in url_list:
            d.write('\t' + base_url + u + '\n')
            x = app.get(base_url + u + '\n')
            d.write('\t' + str(x) + '\n')
            if(x.status_code != 200):
                d.write("test broke on url=" + u)
>           assert(x.status_code == 200)
E           assert 500 == 200
E            +  where 500 = <Response streamed [500 INTERNAL SERVER ERROR]>.status_code

collegejump/test/test_app.py:57: AssertionError
---------------------------------------------- Captured stderr call ----------------------------------------------
[2017-05-01 09:41:41,368] ERROR in app: Exception on /announcement/
 [GET]
Traceback (most recent call last):
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: no such table: announcement

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/collegejump/views.py", line 304, in announcement_page
    return flask.render_template('all_announcements.html', announcements=announcements)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/templating.py", line 134, in render_template
    context, ctx.app)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/templating.py", line 116, in _render
    rv = template.render(context)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 76, in render
    return original_render(self, *args, **kwargs)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/collegejump/templates/all_announcements.html", line 1, in top-level template code
    {% extends "theme.html" %}
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/collegejump/templates/theme.html", line 1, in top-level template code
    {% extends "bootstrap/base.html" %}
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask_bootstrap/templates/bootstrap/base.html", line 1, in top-level template code
    {% block doc -%}
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask_bootstrap/templates/bootstrap/base.html", line 4, in block "doc"
    {%- block html %}
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask_bootstrap/templates/bootstrap/base.html", line 20, in block "html"
    {% block body -%}
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/collegejump/templates/theme.html", line 91, in block "body"
    {% block content -%}
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/collegejump/templates/all_announcements.html", line 11, in block "content"
    {% for announcement in announcements %}
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2855, in __iter__
    return self._execute_and_instances(context)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2878, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 945, in execute
    return meth(self, multiparams, params)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
    context)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
    exc_info
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
    raise value.with_traceback(tb)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: announcement [SQL: 'SELECT announcement.id AS announcement_id, announcement.title AS announcement_title, announcement.content AS announcement_content, announcement.timestamp AS announcement_timestamp, announcement.author_id AS announcement_author_id \nFROM announcement ORDER BY announcement.timestamp DESC']
====================================== 4 failed, 6 passed in 14.37 seconds =======================================
make: *** [Makefile:8: test] Error 1
alexander-bauer commented 7 years ago

@ksilber1 I think this is the issue you mentioned. I believe it is caused by the database having not been created when the requests are fired, and I do not know why they have not been.

alexander-bauer commented 7 years ago

@ksilber1 @ichniow1 I have done a little work to make the test suite "pass" again, by marking the failing test mentioned here as xfail, for "expected failure". This means that it will continue to fail, but not fail the whole suite. This is so we don't start ignoring new errors. When we resolve this (and we should, as soon as possible), we will remove the xfail directive.

alexander-bauer commented 7 years ago

Closed in 44327dc7c0b7f8935f9b39bb1b469819a5af7439.