[ 
https://issues.apache.org/jira/browse/BEAM-14474?focusedWorklogId=771026&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-771026
 ]

ASF GitHub Bot logged work on BEAM-14474:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 16/May/22 20:31
            Start Date: 16/May/22 20:31
    Worklog Time Spent: 10m 
      Work Description: TheNeuralBit commented on code in PR #17682:
URL: https://github.com/apache/beam/pull/17682#discussion_r874129298


##########
sdks/python/apache_beam/dataframe/frames_test.py:
##########
@@ -1723,28 +1729,24 @@ def test_groupby_callable(self):
 
   def test_groupby_apply(self):
     df = GROUPBY_DF
-
-    def median_sum_fn(x):
-      return (x.foo + x.bar).median()
-

Review Comment:
   nit: I would actually keep these where they are and just duplicate the 
filterwarnings calls, so that the tests are more self-contained and easy to 
inspect (but I'm also fine with the move if you prefer it that way)



##########
sdks/python/apache_beam/dataframe/frames_test.py:
##########
@@ -1601,6 +1602,11 @@ def test_pivot_no_index_provided_on_multiindex(self):
 
 class GroupByTest(_AbstractFrameTest):
   """Tests for DataFrame/Series GroupBy operations."""
+  @staticmethod
+  def median_sum_fn(x):
+    warnings.filterwarnings("ignore", message="Mean of empty slice")
+    return (x.foo + x.bar).median()

Review Comment:
   Could we use a 
[context](https://docs.python.org/3/library/warnings.html#temporarily-suppressing-warnings)
 here to make sure the filters get reset?





Issue Time Tracking
-------------------

    Worklog Id:     (was: 771026)
    Time Spent: 1h  (was: 50m)

> Clean up/Fix runtime warning messages in python unit test standard error
> ------------------------------------------------------------------------
>
>                 Key: BEAM-14474
>                 URL: https://issues.apache.org/jira/browse/BEAM-14474
>             Project: Beam
>          Issue Type: Test
>          Components: sdk-py-core
>            Reporter: Yi Hu
>            Priority: P3
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> Currently the log of python unit test results contains thousands of lines of 
> runtime warning / future warning / deprecation warnings, making trouble 
> shooting during development inconvenient. Most of the warning messages are 
> not necessary at all and could be suppressed or fixed if possible. 
> For example, the most popped message is hundreds of lines of 'RuntimeWarning: 
> Mean of empty slice
>     return np.nanmean(a, axis, out=out, keepdims=keepdims)' 
> raised in dataframe tests, which could be suppressed.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to