def test_run(self, dummy_project_dir, startup_script, caplog):
        ipython_loader.run_startup_scripts(dummy_project_dir)
        expected_message = f"Startup script `{startup_script}` successfully executed"

        assert getattr(ipython_loader, "dummy_project_var1") == 111
        assert len(caplog.records) == 1
        assert caplog.records[0].message == expected_message
 def test_run_bad_script(self, dummy_project_dir, bad_startup_script,
                         caplog):
     ipython_loader.run_startup_scripts(dummy_project_dir)
     expected_error_message = (
         f"Startup script `{bad_startup_script}` failed:\nValueError: bad script!"
     )
     assert len(caplog.records) == 1
     assert caplog.records[0].message == expected_error_message
    def test_run_both_scripts(self, dummy_project_dir, startup_script,
                              bad_startup_script, caplog):
        ipython_loader.run_startup_scripts(dummy_project_dir)
        expected_error_message = (
            f"Startup script `{bad_startup_script}` failed:\nValueError: bad script!"
        )
        expected_success_message = "Startup script `{}` successfully executed".format(
            startup_script)

        assert len(caplog.records) == 2
        assert caplog.records[0].message == expected_error_message
        assert caplog.records[1].message == expected_success_message