How to use the cwltest.utils.compare function in cwltest

To help you get started, we’ve selected a few cwltest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github common-workflow-language / cwltest / tests / test_compare.py View on Github external
expected = {
            "location": "cores.txt",
            "size": 2,
            "class": "File",
            "contents": "2\n"
        }

        actual = {
            "basename": "cores.txt",
            "checksum": "sha1$7448d8798a4380162d4b56f9b452e2f6f9e24e7a",
            "class": "File",
            "location": "file:///var/folders/8x/2df05_7j20j6r8y81w4qf43r0000gn/T/tmpG0EkrS/cores.txt",
            "path": get_data("tests/test-data/cores.txt"),
            "size": 2
        }
        compare(expected, actual)
github common-workflow-language / cwltest / cwltest / __init__.py View on Github external
process.kill()

    fail_message = ""

    if test.get("should_fail", False):
        _logger.warning(
            u"""Test %i failed: %s""",
            test_number,
            u" ".join([quote(tc) for tc in test_command]),
        )
        _logger.warning(test.get("doc"))
        _logger.warning(u"Returned zero but it should be non-zero")
        return TestResult(1, outstr, outerr, duration, args.classname)

    try:
        compare(test.get("output"), out)
    except CompareFail as ex:
        _logger.warning(
            u"""Test %i failed: %s""",
            test_number,
            u" ".join([quote(tc) for tc in test_command]),
        )
        _logger.warning(test.get("doc"))
        _logger.warning(u"Compare failure %s", ex)
        fail_message = str(ex)

    if outdir:
        shutil.rmtree(outdir, True)

    return TestResult(
        (1 if fail_message else 0),
        outstr,