diff --git a/redcap/__init__.py b/redcap/__init__.py index f1aed1e2..76745dd0 100644 --- a/redcap/__init__.py +++ b/redcap/__init__.py @@ -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__ \ No newline at end of file +from .version import VERSION as __version__ diff --git a/test/test_package.py b/test/test_package.py new file mode 100644 index 00000000..8c88e5a8 --- /dev/null +++ b/test/test_package.py @@ -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))