You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/02/04 08:08:57 UTC

[buildstream] branch gokcen/refactor_runcli created (now 68fbc2b)

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a change to branch gokcen/refactor_runcli
in repository https://gitbox.apache.org/repos/asf/buildstream.git.


      at 68fbc2b  fixup! fixup! fixup! test

This branch includes the following new commits:

     new f29cd0f  test
     new c6a8114  fixup! test
     new 2d2095b  fixup! fixup! test
     new 68fbc2b  fixup! fixup! fixup! test

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[buildstream] 04/04: fixup! fixup! fixup! test

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch gokcen/refactor_runcli
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 68fbc2b0cc4b8825e293f79efb5cb310072b1244
Author: Gökçen Nurlu <gn...@bloomberg.net>
AuthorDate: Tue Nov 6 12:30:20 2018 +0000

    fixup! fixup! fixup! test
---
 tests/testutils/runcli.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/testutils/runcli.py b/tests/testutils/runcli.py
index 7415177..f9418e4 100644
--- a/tests/testutils/runcli.py
+++ b/tests/testutils/runcli.py
@@ -299,7 +299,8 @@ class Cli(CliRunner):
         return result
 
     def invoke(self, cli, args=None, color=False, binary_capture=False, **extra):
-        r = super().invoke(cli, args, input=os.devnull, color=color)
+        with open(os.devnull) as devnull:
+            r = super().invoke(cli, args, input=devnull, color=color)
 
         return Result(exit_code=r.exit_code,
                       exception=r.exception,


[buildstream] 02/04: fixup! test

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch gokcen/refactor_runcli
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit c6a8114797bf265e1e699ab6bc36059d9beae681
Author: Gökçen Nurlu <gn...@bloomberg.net>
AuthorDate: Sun Nov 4 20:39:32 2018 +0000

    fixup! test
---
 tests/testutils/runcli.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/testutils/runcli.py b/tests/testutils/runcli.py
index 6942216..5d55d98 100644
--- a/tests/testutils/runcli.py
+++ b/tests/testutils/runcli.py
@@ -305,7 +305,7 @@ class Cli(CliRunner):
                       exception=r.exception,
                       exc_info=r.exc_info,
                       output=r.stdout,
-                      stderr=r.stderr)
+                      stderr=r.stderr if r.stderr_bytes else "")
 
     # Fetch an element state by name by
     # invoking bst show on the project with the CLI


[buildstream] 01/04: test

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch gokcen/refactor_runcli
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit f29cd0f3d843c38367764b5d6314dbe7a19777a7
Author: Gökçen Nurlu <gn...@bloomberg.net>
AuthorDate: Fri Nov 2 18:25:01 2018 +0000

    test
---
 tests/testutils/runcli.py | 52 ++++++++---------------------------------------
 1 file changed, 9 insertions(+), 43 deletions(-)

diff --git a/tests/testutils/runcli.py b/tests/testutils/runcli.py
index ce5864b..6942216 100644
--- a/tests/testutils/runcli.py
+++ b/tests/testutils/runcli.py
@@ -7,6 +7,7 @@ import itertools
 import traceback
 import subprocess
 from contextlib import contextmanager, ExitStack
+from click.testing import CliRunner
 from ruamel import yaml
 import pytest
 
@@ -185,9 +186,10 @@ class Result():
         return list(pulled)
 
 
-class Cli():
+class Cli(CliRunner):
 
     def __init__(self, directory, verbose=True, default_options=None):
+        super().__init__(mix_stderr=False)
         self.directory = directory
         self.config = None
         self.verbose = verbose
@@ -297,49 +299,13 @@ class Cli():
         return result
 
     def invoke(self, cli, args=None, color=False, binary_capture=False, **extra):
-        exc_info = None
-        exception = None
-        exit_code = 0
-
-        # Temporarily redirect sys.stdin to /dev/null to ensure that
-        # Popen doesn't attempt to read pytest's dummy stdin.
-        old_stdin = sys.stdin
-        with open(os.devnull) as devnull:
-            sys.stdin = devnull
-            capture_kind = FDCaptureBinary if binary_capture else FDCapture
-            capture = MultiCapture(out=True, err=True, in_=False, Capture=capture_kind)
-            capture.start_capturing()
+        r = super().invoke(cli, args, color=color)
 
-            try:
-                cli.main(args=args or (), prog_name=cli.name, **extra)
-            except SystemExit as e:
-                if e.code != 0:
-                    exception = e
-
-                exc_info = sys.exc_info()
-
-                exit_code = e.code
-                if not isinstance(exit_code, int):
-                    sys.stdout.write('Program exit code was not an integer: ')
-                    sys.stdout.write(str(exit_code))
-                    sys.stdout.write('\n')
-                    exit_code = 1
-            except Exception as e:
-                exception = e
-                exit_code = -1
-                exc_info = sys.exc_info()
-            finally:
-                sys.stdout.flush()
-
-        sys.stdin = old_stdin
-        out, err = capture.readouterr()
-        capture.stop_capturing()
-
-        return Result(exit_code=exit_code,
-                      exception=exception,
-                      exc_info=exc_info,
-                      output=out,
-                      stderr=err)
+        return Result(exit_code=r.exit_code,
+                      exception=r.exception,
+                      exc_info=r.exc_info,
+                      output=r.stdout,
+                      stderr=r.stderr)
 
     # Fetch an element state by name by
     # invoking bst show on the project with the CLI


[buildstream] 03/04: fixup! fixup! test

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch gokcen/refactor_runcli
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 2d2095b077039fe503a2d0c4291609628274bac0
Author: Gökçen Nurlu <gn...@bloomberg.net>
AuthorDate: Mon Nov 5 18:20:06 2018 +0000

    fixup! fixup! test
---
 tests/testutils/runcli.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/testutils/runcli.py b/tests/testutils/runcli.py
index 5d55d98..7415177 100644
--- a/tests/testutils/runcli.py
+++ b/tests/testutils/runcli.py
@@ -299,7 +299,7 @@ class Cli(CliRunner):
         return result
 
     def invoke(self, cli, args=None, color=False, binary_capture=False, **extra):
-        r = super().invoke(cli, args, color=color)
+        r = super().invoke(cli, args, input=os.devnull, color=color)
 
         return Result(exit_code=r.exit_code,
                       exception=r.exception,