Skip to content

Commit e84b359

Browse files
author
Peter Amstutz
committed
Remove command line generation test (--conformance-test) and only test outputs.
1 parent a2ea4e8 commit e84b359

File tree

1 file changed

+24
-43
lines changed

1 file changed

+24
-43
lines changed

cwltool/cwltest.py

Lines changed: 24 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def compare(a, b): # type: (Any, Any) -> bool
5151
return True
5252
else:
5353
if a != b:
54-
raise CompareFail(u"%s != %s" % (a, b))
54+
raise CompareFail(u"%s != %s" % (json.dumps(a), json.dumps(b)))
5555
else:
5656
return True
5757
except Exception as e:
@@ -62,33 +62,19 @@ def run_test(args, i, t): # type: (argparse.Namespace, Any, Dict[str,str]) -> i
6262
out = {} # type: Dict[str,Any]
6363
outdir = None
6464
try:
65-
if "output" in t:
66-
test_command = [args.tool]
67-
# Add prefixes if running on MacOSX so that boot2docker writes to /Users
68-
if 'darwin' in sys.platform:
69-
outdir = tempfile.mkdtemp(prefix=os.path.abspath(os.path.curdir))
70-
test_command.extend(["--tmp-outdir-prefix={}".format(outdir), "--tmpdir-prefix={}".format(outdir)])
71-
else:
72-
outdir = tempfile.mkdtemp()
73-
test_command.extend(["--outdir={}".format(outdir),
74-
"--quiet",
75-
t["tool"],
76-
t["job"]])
77-
outstr = subprocess.check_output(test_command)
78-
out = {"output": json.loads(outstr)}
65+
test_command = [args.tool]
66+
# Add prefixes if running on MacOSX so that boot2docker writes to /Users
67+
if 'darwin' in sys.platform:
68+
outdir = tempfile.mkdtemp(prefix=os.path.abspath(os.path.curdir))
69+
test_command.extend(["--tmp-outdir-prefix={}".format(outdir), "--tmpdir-prefix={}".format(outdir)])
7970
else:
80-
test_command = [args.tool,
81-
"--conformance-test",
82-
"--basedir=" + args.basedir,
83-
"--no-container",
84-
"--quiet",
85-
t["tool"],
86-
t["job"]]
87-
88-
outstr = subprocess.check_output(test_command)
89-
out = yaml.load(outstr)
90-
if not isinstance(out, dict):
91-
raise ValueError("Non-dict value parsed from output string.")
71+
outdir = tempfile.mkdtemp()
72+
test_command.extend(["--outdir={}".format(outdir),
73+
"--quiet",
74+
t["tool"],
75+
t["job"]])
76+
outstr = subprocess.check_output(test_command)
77+
out = json.loads(outstr)
9278
except ValueError as v:
9379
_logger.error(str(v))
9480
_logger.error(outstr)
@@ -111,22 +97,17 @@ def run_test(args, i, t): # type: (argparse.Namespace, Any, Dict[str,str]) -> i
11197
# t["stdin"] = t["stdin"].replace("$PWD", pwd)
11298

11399
failed = False
114-
if "output" in t:
115-
checkkeys = ["output"]
116-
else:
117-
checkkeys = ["args", "stdin", "stderr", "stdout", "createfiles"]
118-
119-
for key in checkkeys:
120-
try:
121-
compare(t.get(key), out.get(key))
122-
except CompareFail as ex:
123-
_logger.warn(u"""Test failed: %s""", " ".join([pipes.quote(tc) for tc in test_command]))
124-
_logger.warn(t.get("doc"))
125-
_logger.warn(u"%s expected %s\n got %s", key,
126-
json.dumps(t.get(key), indent=4, sort_keys=True),
127-
json.dumps(out.get(key), indent=4, sort_keys=True))
128-
_logger.warn(u"Compare failure %s", ex)
129-
failed = True
100+
101+
try:
102+
compare(t.get("output"), out)
103+
except CompareFail as ex:
104+
_logger.warn(u"""Test failed: %s""", " ".join([pipes.quote(tc) for tc in test_command]))
105+
_logger.warn(t.get("doc"))
106+
_logger.warn(u"expected output object %s\n got %s",
107+
json.dumps(t.get("output"), indent=4, sort_keys=True),
108+
json.dumps(out, indent=4, sort_keys=True))
109+
_logger.warn(u"Compare failure %s", ex)
110+
failed = True
130111

131112
if outdir:
132113
shutil.rmtree(outdir, True) # type: ignore

0 commit comments

Comments
 (0)