File tree Expand file tree Collapse file tree 10 files changed +85
-8
lines changed Expand file tree Collapse file tree 10 files changed +85
-8
lines changed Original file line number Diff line number Diff line change
1
+ [run]
2
+ branch = True
3
+ source = cwltest
4
+ omit = cwltest/tests/*
5
+
6
+ [report]
7
+ exclude_lines =
8
+ if self.debug:
9
+ pragma: no cover
10
+ raise NotImplementedError
11
+ if __name__ == .__main__.:
12
+ ignore_errors = True
13
+ omit =
14
+ cwltest/tests/*
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ diff_pylint_report: pylint_report.txt
112
112
diff-quality --violations=pylint pylint_report.txt
113
113
114
114
.coverage : $(PYSOURCES ) all
115
- python setup.py test --addopts " --cov --cov-config=.coveragerc --cov-report= -n auto ${PYTEST_EXTRA} "
115
+ python setup.py test --addopts " --cov --cov-config=.coveragerc --cov-report= ${PYTEST_EXTRA} "
116
116
117
117
coverage.xml : .coverage
118
118
coverage xml
Original file line number Diff line number Diff line change 1
1
import argparse
2
+ import sys
3
+ from time import sleep
2
4
3
5
from cwltest import UNSUPPORTED_FEATURE
4
6
5
7
UNSUPPORTED_FEATURE_TOOL = "return-unsupported.cwl"
6
8
ERROR_TOOL = "return-1.cwl"
9
+ TIMEOUT_TOOL = "timeout.cwl"
7
10
8
11
9
- def main (): # type: ()-> int
12
+ def main () -> int :
10
13
parser = argparse .ArgumentParser ()
11
14
parser .add_argument ("processfile" )
12
15
parser .add_argument ("jobfile" )
@@ -20,6 +23,11 @@ def main(): # type: ()->int
20
23
exit (UNSUPPORTED_FEATURE )
21
24
elif args .processfile .endswith (ERROR_TOOL ):
22
25
exit (1 )
26
+ elif args .processfile .endswith (TIMEOUT_TOOL ):
27
+ print ("timeout stderr" , file = sys .stderr )
28
+ sys .stderr .flush ()
29
+ sleep (100000 )
30
+ exit (1 )
23
31
24
32
exit (0 )
25
33
Original file line number Diff line number Diff line change
1
+ class: CommandLineTool
2
+ cwlVersion: v1.0
3
+ inputs : []
4
+ outputs : []
5
+ baseCommand : [sleep, "15" ]
Original file line number Diff line number Diff line change
1
+ - job : v1.0/empty.json
2
+ output :
3
+ output_txt :
4
+ class : File
5
+ checksum : sha1$47a013e660d408619d894b20806b1d5086aab03b
6
+ location : output.txt
7
+ size : 13
8
+ tool : timeout.cwl
9
+ doc : Test of timeout stdout and stderr capture
Original file line number Diff line number Diff line change
1
+ {}
Original file line number Diff line number Diff line change
1
+ import re
2
+ import os
3
+ from os import linesep as n
4
+ from os import sep as p
5
+ from pathlib import Path
6
+
7
+ import defusedxml .ElementTree as ET
8
+
9
+ from .util import run_with_mock_cwl_runner , get_data
10
+ import schema_salad .ref_resolver
11
+
12
+
13
+ def test_timeout_stderr_stdout (tmp_path ):
14
+ junit_xml_report = tmp_path / "junit-report.xml"
15
+
16
+ args = [
17
+ "--test" ,
18
+ schema_salad .ref_resolver .file_uri (get_data ("tests/test-data/timeout.yml" )),
19
+ "--timeout" ,
20
+ "5" ,
21
+ "--junit-xml" ,
22
+ str (junit_xml_report ),
23
+ ]
24
+ try :
25
+ cwd = os .getcwd ()
26
+ os .chdir (get_data ("tests/test-data/" ))
27
+ error_code , stdout , stderr = run_with_mock_cwl_runner (args )
28
+ finally :
29
+ os .chdir (cwd )
30
+
31
+ assert error_code == 1
32
+ assert "Test 1 timed out" in stderr
33
+ tree = ET .parse (junit_xml_report )
34
+ try :
35
+ root = tree .getroot ()
36
+ timeout_text = root .find ("testsuite" ).find ("testcase" ).find ("failure" ).text
37
+ timeout_stderr = root .find ("testsuite" ).find ("testcase" ).find ("system-err" ).text
38
+ assert "Test timed out" in timeout_text
39
+ assert "timeout stderr" in timeout_stderr
40
+ except AttributeError as e :
41
+ print (junit_xml_report .read_text ())
42
+ raise e
Original file line number Diff line number Diff line change 1
1
import os
2
- import sys
3
2
4
3
import subprocess # nosec
5
4
11
10
12
11
13
12
def get_data (filename ):
14
- filename = os .path .normpath (
15
- filename
16
- ) # normalizing path depending on OS or else it will cause problem when joining path
13
+ filename = os .path .normpath (filename )
14
+ # normalizing path depending on OS or else it will cause problem when
15
+ # joining path
17
16
filepath = None
18
17
try :
19
18
filepath = resource_filename (Requirement .parse ("cwltest" ), filename )
Original file line number Diff line number Diff line change 1
1
pytest >= 6.2, < 6.3
2
2
pytest-cov
3
- pytest-xdist
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ skipsdist = True
12
12
skip_missing_interpreters = True
13
13
14
14
[pytest]
15
- addopts =-n auto --pyargs cwltest
15
+ addopts = --pyargs cwltest
16
16
testpaths = cwltest/tests
17
17
18
18
[gh-actions]
You can’t perform that action at this time.
0 commit comments