global return_code
try:
- banner = (
- f'asyncio REPL {sys.version} on {sys.platform}\n'
- f'Use "await" directly instead of "asyncio.run()".\n'
- f'Type "help", "copyright", "credits" or "license" '
- f'for more information.\n'
- )
-
- console.write(banner)
+ if not sys.flags.quiet:
+ banner = (
+ f'asyncio REPL {sys.version} on {sys.platform}\n'
+ f'Use "await" directly instead of "asyncio.run()".\n'
+ f'Type "help", "copyright", "credits" or "license" '
+ f'for more information.\n'
+ )
+
+ console.write(banner)
if startup_path := os.getenv("PYTHONSTARTUP"):
sys.audit("cpython.run_startup", startup_path)
expected = "toplevel contextvar test: ok"
self.assertIn(expected, output, expected)
+ def test_quiet_mode(self):
+ p = spawn_repl("-q", "-m", "asyncio", custom=True)
+ output = kill_python(p)
+ self.assertEqual(p.returncode, 0)
+ self.assertEqual(output[:3], ">>>")
+
if __name__ == "__main__":
unittest.main()