diff options
author | Zuul <zuul@review.opendev.org> | 2022-12-20 16:25:03 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2022-12-20 16:25:03 +0000 |
commit | 72281b9f93139f5069035ef586867addb1f909f4 (patch) | |
tree | 17b133398c1cae519c7778ce5af4e1ff1d3d7a9c /nova/tests | |
parent | 7f7aabd26e1a65092581418e7f562f9af1db2231 (diff) | |
parent | 628e1c152cc7c5e89d5261fc6f25ec72ac24c1df (diff) | |
download | nova-72281b9f93139f5069035ef586867addb1f909f4.tar.gz |
Merge "Add a hacking rule for the setDaemon method"
Diffstat (limited to 'nova/tests')
-rw-r--r-- | nova/tests/unit/test_hacking.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/nova/tests/unit/test_hacking.py b/nova/tests/unit/test_hacking.py index 10b2a79db4..41cbada99f 100644 --- a/nova/tests/unit/test_hacking.py +++ b/nova/tests/unit/test_hacking.py @@ -1043,3 +1043,24 @@ class HackingTestCase(test.NoDBTestCase): import unittest.mock """ self._assert_has_no_errors(code, checks.import_stock_mock) + + def test_check_set_daemon(self): + code = """ + self.setDaemon(True) + worker.setDaemon(True) + self._event_thread.setDaemon(True) + mythread.setDaemon(False) + self.thread.setDaemon(1) + """ + errors = [(x + 1, 0, 'N372') for x in range(5)] + self._assert_has_errors( + code, checks.check_set_daemon, expected_errors=errors) + + code = """ + self.setDaemon = True + worker.setDaemonFlag(True) + self._event_thread.resetDaemon(True) + self.set.Daemon(True) + self.thread.setdaemon(True) + """ + self._assert_has_no_errors(code, checks.check_set_daemon) |