Skip to content
This repository has been archived by the owner on Jan 3, 2019. It is now read-only.

Commit

Permalink
Adding coverage configuration file.
Browse files Browse the repository at this point in the history
  • Loading branch information
rich-hart committed Feb 17, 2015
1 parent e113b6a commit 333bcf1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
19 changes: 19 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# .coveragerc to control coverage.py
[run]
branch = True

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain about missing debug-only code:

# Don't complain if tests don't hit defensive assertion code:
raise NotImplementedError

ignore_errors = True

[html]
directory = coverage_html_report
5 changes: 4 additions & 1 deletion cnxauthoring/storage/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ class PostgresqlStorage(BaseStorage):
Error = psycopg2.Error

def __init__(self, db_connection_string=None):
#initialize db
# initialize db
self.conn = psycopg2.connect(db_connection_string)
# adding a variable to store the db_connection string
# needed to restart the database when a connection
# is broken or lost.
self.db_connection_string = db_connection_string

def get(self, type_=Document, **kwargs):
Expand Down
4 changes: 4 additions & 0 deletions cnxauthoring/tests/test_storage/test_postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ def test_add_get_and_remove_binder(self):
{'user2': ('view',)})

def test_restart(self):
"""
Testing PostrgressStorage class restart function
with a password connection string.
"""
from ...storage.database import CONNECTION_SETTINGS_KEY
import psycopg2
settings = integration_test_settings()
Expand Down

0 comments on commit 333bcf1

Please sign in to comment.