Skip to content

Commit

Permalink
Merge pull request #13 from whikloj/issue-11
Browse files Browse the repository at this point in the history
Set root logger level, also use simpler subprocess.run()
  • Loading branch information
acdha authored Nov 18, 2021
2 parents 4c7b1c2 + 9e06eea commit 9ab4870
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test-harness
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ def run_version_suite(test_program_argv, version_dir):
if not os.path.isdir(os.path.join(test_subsuite_directory, test_bag)):
continue

proc = subprocess.Popen(test_program_argv + [test_bag],
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
cwd=test_subsuite_directory)
rc = proc.wait()
stdout, stderr = proc.communicate()
proc = subprocess.run(test_program_argv + [test_bag],
capture_output=True,
cwd=test_subsuite_directory)

rc = proc.returncode
stdout = proc.stdout
stderr = proc.stderr

# We'll select the log level based on whether we expected an error:
log_f = logging.info
Expand Down Expand Up @@ -101,6 +103,7 @@ def configure_logging(verbosity=0):
stdout_handler = logging.StreamHandler(stream=sys.stdout)
stdout_handler.setLevel(desired_level)
logging.getLogger().addHandler(stdout_handler)
logging.getLogger().setLevel(desired_level)
else:
logging.basicConfig(level=logging.WARNING, stream=sys.stderr)

Expand Down

0 comments on commit 9ab4870

Please sign in to comment.