Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: in order to support python 3.7, which has no `unittest.TestCase._callSetUp()` or `unittest.TestCase._callTearDown()` method, we add and remove alarms in the override of `unittest.TestCase.run()` Pull Request resolved: facebook#691 Test Plan: I tested this out in buck, with both an artificial timeout and an error and it gave normal output ``` test_fetch_mock_adhoc_fetcher: NoDataError: No metrics have availability overlapping with date range (2020-07-02, 2020-07-05). Failures: 1) ax.fb.utils.deltoid.tests.test_deltoid_apis.Deltoid3APIsTest: test_fetch_mock_adhoc_fetcher 1) NoDataError: No metrics have availability overlapping with date range (2020-07-02, 2020-07-05). File "ax/fb/utils/deltoid/tests/test_deltoid_apis.py", line 785, in test_fetch_mock_adhoc_fetcher fetcher = MockDeltoidAdhocFetcher(trial=self.trial, metrics=self.metrics) File "ax/fb/utils/deltoid/mock.py", line 54, in __init__ super().__init__( File "ax/fb/utils/deltoid/deltoid_apis.py", line 259, in __init__ raise NoDataError( Imports took: 41.1s! Profile with --import-profiler. --_ |""---__ Executed 1 example in 41.7s: |'.| || . """| Successful: 0 | || || /|\""-. | Failed: 1 | || || | | | Skipped: 0 | || || | \|/ | Not executed: 38 |."| || --"" '__| https://testslide.readthedocs.io/ --" |__---""" Failure: process exited with rc=1. (43.0s) ``` ``` test_fetch_mock_adhoc_fetcher: Exception: Test timed out at 1 seconds Failures: 1) ax.fb.utils.deltoid.tests.test_deltoid_apis.Deltoid3APIsTest: test_fetch_mock_adhoc_fetcher 1) Exception: Test timed out at 1 seconds File "ax/fb/utils/deltoid/tests/test_deltoid_apis.py", line 786, in test_fetch_mock_adhoc_fetcher sleep(2) File "ax/utils/common/testutils.py", line 225, in signal_handler raise Exception(f"Test timed out at {self.MAX_TEST_SECONDS} seconds") Imports took: 41.2s! Profile with --import-profiler. --_ |""---__ Executed 1 example in 42.8s: |'.| || . """| Successful: 0 | || || /|\""-. | Failed: 1 | || || | | | Skipped: 0 | || || | \|/ | Not executed: 38 |."| || --"" '__| https://testslide.readthedocs.io/ --" |__---""" Failure: process exited with rc=1. (44.6s) ``` Also tested both failure varieties in pytest and they look normal in 3.7 and 3.8, but those outputs are much longer. Reviewed By: lena-kashtelyan Differential Revision: D30843594 Pulled By: danielcohenlive fbshipit-source-id: 5b9fdfb06e74a146eda222d03a6cfe3647bcde68
- Loading branch information