Skip to content

Commit

Permalink
fixes windows test
Browse files Browse the repository at this point in the history
Signed-off-by: Wenqi Li <[email protected]>
  • Loading branch information
wyli committed Aug 21, 2023
1 parent a99f61b commit 71a001e
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tests/test_rankfilter_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,20 @@ def test_rankfilter(self):
log_message = " ".join(lines)
self.assertEqual(log_message.count("test_warnings"), 1)

def tearDown(self) -> None:
self.log_dir.cleanup()


class SingleRankFilterTest(unittest.TestCase):
def tearDown(self) -> None:
self.log_dir.cleanup()

def setUp(self):
self.log_dir = tempfile.TemporaryDirectory()

def test_rankfilter_single_proc(self):
logger = logging.getLogger(__name__)
log_filename = os.path.join(self.log_dir.name, "records.log")
log_filename = os.path.join(self.log_dir.name, "records_sp.log")
h1 = logging.FileHandler(filename=log_filename)
h1.setLevel(logging.WARNING)
logger.addHandler(h1)
Expand All @@ -56,12 +67,11 @@ def test_rankfilter_single_proc(self):

with open(log_filename) as file:
lines = [line.rstrip() for line in file]
logger.removeHandler(h1)
h1.close()
log_message = " ".join(lines)
self.assertEqual(log_message.count("test_warnings"), 1)

def tearDown(self) -> None:
self.log_dir.cleanup()


if __name__ == "__main__":
unittest.main()

0 comments on commit 71a001e

Please sign in to comment.