MCPcopy Create free account
hub / github.com/dwavesystems/dwave-cloud-client / test_file_logging

Method test_file_logging

tests/test_utils.py:1205–1222  ·  view source on GitHub ↗
(self, output)

Source from the content-addressed store, hash-verified

1203
1204 @capture_stderr
1205 def test_file_logging(self, output):
1206 with tempfile.TemporaryDirectory() as dir:
1207 logfile = os.path.join(dir, "out.log")
1208
1209 configure_logging(logger, output_file=logfile)
1210
1211 logger.error('test-msg')
1212
1213 # log msg is in the log file
1214 with open(logfile, "r") as fp:
1215 self.assertIn('test-msg', fp.read())
1216
1217 # there're no logs on stderr
1218 output.seek(0)
1219 self.assertEqual(output.read(), '')
1220
1221 # reset log config to enable temp dir cleanup
1222 configure_logging(logger)
1223
1224
1225class TestLoggingHelpers(unittest.TestCase):

Callers

nothing calls this directly

Calls 2

configure_loggingFunction · 0.90
seekMethod · 0.80

Tested by

no test coverage detected