Mercurial > repos > shellac > sam_consensus_v3
comparison env/lib/python3.9/site-packages/cwltool/tests/test_context.py @ 0:4f3585e2f14b draft default tip
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author | shellac |
---|---|
date | Mon, 22 Mar 2021 18:12:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4f3585e2f14b |
---|---|
1 import subprocess | |
2 | |
3 from cwltool.context import RuntimeContext | |
4 | |
5 from .util import get_data, get_windows_safe_factory, windows_needs_docker | |
6 | |
7 | |
8 @windows_needs_docker | |
9 def test_replace_default_stdout_stderr() -> None: | |
10 """Test our ability to replace the default stdout/err.""" | |
11 import sys | |
12 | |
13 # break stdout & stderr | |
14 original_stdout = sys.stdout | |
15 original_stderr = sys.stderr | |
16 | |
17 sys.stdout = "" # type: ignore | |
18 sys.stderr = "" # type: ignore | |
19 | |
20 runtime_context = RuntimeContext() | |
21 runtime_context.default_stdout = subprocess.DEVNULL # type: ignore | |
22 runtime_context.default_stderr = subprocess.DEVNULL # type: ignore | |
23 factory = get_windows_safe_factory(runtime_context=runtime_context) | |
24 echo = factory.make(get_data("tests/echo.cwl")) | |
25 | |
26 assert echo(inp="foo") == {"out": "foo\n"} | |
27 sys.stdout = original_stdout | |
28 sys.stderr = original_stderr |