dtr-org / unit-e

A digital currency for a new era of decentralized trust
https://unit-e.io
MIT License
45 stars 15 forks source link

Add interactive-test-runner #1118

Closed scravy closed 5 years ago

scravy commented 5 years ago

This adds an alternative test runner which prints the currently running tests and how long they are running for. See screenshot:

Screenshot 2019-05-31 09 44 54
Ruteri commented 5 years ago
  File "./contrib/devtools/interactive-test-runner.py", line 237, in <module>
    main()
  File "./contrib/devtools/interactive-test-runner.py", line 232, in main
    tests_order=tests_order
  File "./contrib/devtools/interactive-test-runner.py", line 100, in __init__
    self.repo_root = self.find_git_root()
  File "./contrib/devtools/interactive-test-runner.py", line 115, in find_git_root
    return self.run_command('git', 'rev-parse', '--show-toplevel')
  File "./contrib/devtools/interactive-test-runner.py", line 111, in run_command
    proc = subprocess.run(args, capture_output=True, encoding='utf8', check=True, **kwargs)
  File "/usr/lib/python3.6/subprocess.py", line 403, in run
    with Popen(*popenargs, **kwargs) as process:
TypeError: __init__() got an unexpected keyword argument 'capture_output'

As far as I know this is exactly the same but will work on most of the platforms (also check_output is the idea behind check=True and capture_output=True):

index 866a90e9a..f95d824e3 100755
--- a/contrib/devtools/interactive-test-runner.py
+++ b/contrib/devtools/interactive-test-runner.py
@@ -108,8 +108,8 @@ class InteractiveTestRunner:

     @staticmethod
     def run_command(*args, **kwargs):
-        proc = subprocess.run(args, capture_output=True, encoding='utf8', check=True, **kwargs)
-        return proc.stdout.strip()
+        proc = subprocess.check_output(args, encoding='utf8', **kwargs)
+        return proc.strip()

     def find_git_root(self):
         return self.run_command('git', 'rev-parse', '--show-toplevel')
scravy commented 5 years ago

@Ruteri changed in 2c15619db0ad872883af1c6e68c829621432d759