Skip to content

Commit

Permalink
Removed Test_Affinnity.test_unpinned since other unit tests provide t…
Browse files Browse the repository at this point in the history
…he same coverage; Removal of test_unpinned simplifies the setUp for pinning to 0
  • Loading branch information
comrumino committed Jul 2, 2022
1 parent 8ee00cd commit b24257f
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions tests/test_affinity.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def tearDownClass(cls):
setattr(rpyc.core.protocol.Connection, '_dispatch', cls._orig_func)

def setUp(self):
self._os.sched_setaffinity(0, {0, })
self.conn = rpyc.connect_thread(rpyc.ClassicService, self.cfg, rpyc.ClassicService, self.cfg)
self.bg_threads = [rpyc.BgServingThread(self.conn) for i in range(3)]

Expand All @@ -66,20 +67,11 @@ def _reset_affinity(self):
if self._os is not None:
return self._os.sched_setaffinity(0, self._orig_affinity)

def test_unpinned(self):
"""test without changing the default processor affinity"""
max_elapsed_time = self.cfg['sync_request_timeout']
elapsed_time = self._time_execute_sleep()
self.assertLess(elapsed_time, max_elapsed_time)
self.assertIn('count=0', repr(self.conn._recvlock))

def test_pinned_to_0(self):
"""test behavior with processor affinity set such that this process is pinned to 0"""
if self._skip:
raise self._skip
max_elapsed_time = self.cfg['sync_request_timeout']
self._os.sched_setaffinity(0, {0, })
elapsed_time = self._time_execute_sleep()

self.assertLess(elapsed_time, max_elapsed_time)
self.assertIn('count=0', repr(self.conn._recvlock))

0 comments on commit b24257f

Please sign in to comment.