MCPcopy Create free account
hub / github.com/ipython/traitlets / test_log_collisions

Method test_log_collisions

tests/config/test_application.py:555–573  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

553
554 @pytest.mark.skipif(not hasattr(TestCase, "assertLogs"), reason="requires TestCase.assertLogs")
555 def test_log_collisions(self):
556 app = MyApp()
557 app.log = logging.getLogger()
558 app.log.setLevel(logging.INFO)
559 name = "config"
560 with TemporaryDirectory("_1") as td:
561 with open(pjoin(td, name + ".py"), "w") as f:
562 f.write("get_config().Bar.b = 1")
563 with open(pjoin(td, name + ".json"), "w") as f:
564 json.dump({"Bar": {"b": 2}}, f)
565 with self.assertLogs(app.log, logging.WARNING) as captured:
566 app.load_config_file(name, path=[td])
567 app.init_bar()
568 assert app.bar.b == 2
569 output = "\n".join(captured.output)
570 assert "Collision" in output
571 assert "1 ignored, using 2" in output
572 assert pjoin(td, name + ".py") in output
573 assert pjoin(td, name + ".json") in output
574
575 @pytest.mark.skipif(not hasattr(TestCase, "assertLogs"), reason="requires TestCase.assertLogs")
576 def test_log_bad_config(self):

Callers

nothing calls this directly

Calls 3

init_barMethod · 0.95
load_config_fileMethod · 0.80
MyAppClass · 0.70

Tested by

no test coverage detected