Exemplo n.º 1
0
    def exec_module(self):
        """
        Execs module.
        """

        with OutputCapture() as output:
            try:
                self.module.main()
            except SystemExit as e:
                self.retcode = e.code

        self.stdout = output.stdout
        self.stderr = output.stderr

        return
Exemplo n.º 2
0
    def exec_module(self):
        """
        Execs module.
        """

        with OutputCapture() as output:
            try:
                with warnings.catch_warnings():
                    warnings.simplefilter("ignore")
                    self.module.main()
            except SystemExit as e:
                self.retcode = e.code

        self.stdout = output.stdout
        self.stderr = output.stderr

        return
Exemplo n.º 3
0
    def exec_module(self, stdin=None):
        """
        Execs module.
        """

        if stdin is not None:
            sys.stdin = StringIO(stdin)

        with OutputCapture() as output:
            try:
                self.module.main()
            except SystemExit as e:
                self.retcode = e.code

        self.stdout = output.stdout
        self.stderr = output.stderr

        sys.stdin = sys.__stdin__  # restore

        return