def pytest_cmdline_parse( self, pluginmanager: PytestPluginManager, args: List[str] ) -> object: try: self.parse(args) except UsageError: # Handle --version and --help here in a minimal fashion. # This gets done via helpconfig normally, but its # pytest_cmdline_main is not called in case of errors. if getattr(self.option, "version", False) or "--version" in args: from _pytest.helpconfig import showversion showversion(self) elif ( getattr(self.option, "help", False) or "--help" in args or "-h" in args ): self._parser._getparser().print_help() sys.stdout.write( "\nNOTE: displaying only minimal help due to UsageError.\n\n" ) raise return self
def pytest_cmdline_parse(self, pluginmanager, args): try: self.parse(args) except UsageError: # Handle --version and --help here in a minimal fashion. # This gets done via helpconfig normally, but its # pytest_cmdline_main is not called in case of errors. if getattr(self.option, "version", False) or "--version" in args: from _pytest.helpconfig import showversion showversion(self) elif ( getattr(self.option, "help", False) or "--help" in args or "-h" in args ): self._parser._getparser().print_help() sys.stdout.write( "\nNOTE: displaying only minimal help due to UsageError.\n\n" ) raise return self