def test(): from hdl_checker import server from hdl_checker import __version__ as version with patch.object(server, "sys") as sys: with patch.object(server.argparse._sys, "argv", [p.abspath(server.__file__), "--version"]): server.parseArguments() sys.stdout.write.assert_called_with(version + "\n") sys.exit.assert_called_with(0)
def test(): from hdl_checker import server with patch.object(server.argparse._sys, "argv", [p.abspath(server.__file__), "--lsp"]): args = server.parseArguments() if ON_LINUX: it.assertEqual( p.basename(args.log_stream), "hdl_checker_log_pid{}.log".format(os.getpid()), ) it.assertEqual( p.basename(args.stderr), "hdl_checker_stderr_pid{}.log".format(os.getpid()), ) else: it.assertTrue( p.basename( args.log_stream).startswith("hdl_checker_log_pid"), "log file should not be {}".format(args.stderr), ) it.assertTrue( p.basename( args.stderr).startswith("hdl_checker_stderr_pid"), "stderr file should not be {}".format(args.stderr), )
def test(): from hdl_checker import server # Check it works with LSP with patch.object( server.argparse._sys, "argv", [p.abspath(server.__file__), "--lsp", "--stderr", "NONE"], ): args = server.parseArguments() it.assertIsNone(args.stderr) # Check it works with HTTP server with patch.object( server.argparse._sys, "argv", [p.abspath(server.__file__), "--stderr", "NONE"], ): args = server.parseArguments() it.assertIsNone(args.stderr)