[ https://issues.apache.org/jira/browse/BEAM-5745?focusedWorklogId=158263&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-158263 ]
ASF GitHub Bot logged work on BEAM-5745: ---------------------------------------- Author: ASF GitHub Bot Created on: 24/Oct/18 18:42 Start Date: 24/Oct/18 18:42 Worklog Time Spent: 10m Work Description: tvalentyn commented on a change in pull request #6687: [BEAM-5745] Fix annotation test for py3 URL: https://github.com/apache/beam/pull/6687#discussion_r227913982 ########## File path: sdks/python/apache_beam/utils/annotations_test.py ########## @@ -32,9 +32,12 @@ def test_deprecated_with_since_current_message(self): @deprecated(since='v.1', current='multiply', extra_message='Do this') def fnc_test_deprecated_with_since_current_message(): return 'lol' + # In python2, the test framework by default adds an ignore filtering rule. Review comment: Thanks. Turns out DeprecationWarnings are ignored by default, not just on Python 2, see: https://docs.python.org/3/library/warnings.html. So I suggest the following wording (let's add a clarifying comment for all test methods that need this). ``` def test_deprecated_with_since_current_message(self): with warnings.catch_warnings(record=True) as w: # Deprecation warnings are ignored by default, turn them on to enable testing. warnings.simplefilter("once", DeprecationWarning) ``` Adding this to each individual test is the right thing, since we add a filter override inside `catch_warnings` context manager, so it will not affect other tests in the suite. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 158263) Time Spent: 3h 20m (was: 3h 10m) > Util test on annotations fails > ------------------------------- > > Key: BEAM-5745 > URL: https://issues.apache.org/jira/browse/BEAM-5745 > Project: Beam > Issue Type: Sub-task > Components: sdk-py-core > Reporter: Ruoyun Huang > Assignee: Ruoyun Huang > Priority: Minor > Time Spent: 3h 20m > Remaining Estimate: 0h > > Traceback (most recent call last): > File > "/usr/local/google/home/ruoyun/projects/beam/sdks/python/apache_beam/utils/annotations_test.py", > line 142, in test_frequency > label_check_list=[]) > File > "/usr/local/google/home/ruoyun/projects/beam/sdks/python/apache_beam/utils/annotations_test.py", > line 149, in check_annotation > self.assertIn(fnc_name + ' is ' + annotation_type, > str(warning[-1].message)) > AssertionError: 'fnc2_test_annotate_frequency is experimental' not found in > 'fnc_test_annotate_frequency is experimental.' -- This message was sent by Atlassian JIRA (v7.6.3#76005)