Skip to content

Commit

Permalink
Merge pull request redcap-tools#22 from sburns/query-deprecation
Browse files Browse the repository at this point in the history
Add warning for Query & QueryGroup deprecation
  • Loading branch information
Scott Burns committed Nov 11, 2013
2 parents a2a1b86 + 27a1012 commit 271babe
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
4 changes: 3 additions & 1 deletion redcap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class with the URL to your REDCap system along with an API key, probably
"""

from .project import Project
import warnings
warnings.warn("Query & QueryGroup will be removed at 1.0.", DeprecationWarning)
from .query import Query, QueryGroup
from .request import RCRequest, RCAPIError, RedcapError
from .version import VERSION as __version__
from .version import VERSION as __version__
21 changes: 21 additions & 0 deletions test/test_package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from unittest import TestCase
import warnings
warnings.simplefilter('always')


class PackageTest(TestCase):

def setUp(self):
pass

def tearDown(self):
pass

def test_query_deprecation(self):
"Test that importing redcap introduces a DeprecationWarning"
with warnings.catch_warnings(record=True) as w:
# This should generate a DeprecationWarning
import redcap
# http://docs.python.org/2/library/warnings.html#testing-warnings
self.assertTrue(issubclass(w[-1].category, DeprecationWarning))
self.assertIn("Query & QueryGroup will be removed", str(w[-1].message))

0 comments on commit 271babe

Please sign in to comment.