forked from redcap-tools/PyCap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request redcap-tools#22 from sburns/query-deprecation
Add warning for Query & QueryGroup deprecation
- Loading branch information
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |