Commit bd1333bb authored by Kirill Smelkov's avatar Kirill Smelkov

log += title and argv for ran testcase

When there are several or many testcases, it is hard to understand - by
seeing just log or console output - which part of the test suite was
running. It also helps to see the exact command that was spawned.

Example output for pygolang. Before:

    (neo) (z-dev) (g.env) kirr@deco:~/src/tools/go/pygolang$ nxdtest
    ============================= test session starts ==============================
    platform linux2 -- Python 2.7.18, pytest-4.6.11, py-1.9.0, pluggy-0.13.1
    rootdir: /home/kirr/src/tools/go/pygolang
    collected 112 items

    golang/_gopath_test.py ..                                                [  1%]
    golang/context_test.py ..                                                [  3%]
    golang/cxx_test.py ..                                                    [  5%]
    golang/errors_test.py ........                                           [ 12%]
    golang/fmt_test.py ...                                                   [ 15%]
    golang/golang_test.py ................................................   [ 58%]
    golang/io_test.py .                                                      [ 58%]
    golang/strconv_test.py ..                                                [ 60%]
    golang/strings_test.py .....                                             [ 65%]
    golang/sync_test.py .............                                        [ 76%]
    golang/time_test.py ........                                             [ 83%]
    golang/pyx/build_test.py ...                                             [ 86%]
    golang/pyx/runtime_test.py .                                             [ 87%]
    gpython/gpython_test.py ssssss.sssssss                                   [100%]

    ==================== 99 passed, 13 skipped in 5.42 seconds =====================
    ok      thread  5.656s  # 112t 0e 0f 13s
    ============================= test session starts ==============================
    platform linux2 -- Python 2.7.18, pytest-4.6.11, py-1.9.0, pluggy-0.13.1
    rootdir: /home/kirr/src/tools/go/pygolang
    collected 112 items

    golang/_gopath_test.py ..                                                [  1%]
    golang/context_test.py ..                                                [  3%]
    golang/cxx_test.py ..                                                    [  5%]
    golang/errors_test.py ........                                           [ 12%]
    golang/fmt_test.py ...                                                   [ 15%]
    golang/golang_test.py ................................................   [ 58%]
    golang/io_test.py .                                                      [ 58%]
    golang/strconv_test.py ..                                                [ 60%]
    golang/strings_test.py .....                                             [ 65%]
    golang/sync_test.py .............                                        [ 76%]
    golang/time_test.py ........                                             [ 83%]
    golang/pyx/build_test.py ...                                             [ 86%]
    golang/pyx/runtime_test.py .                                             [ 87%]
    gpython/gpython_test.py ..............                                   [100%]

    ========================= 112 passed in 17.35 seconds ==========================
    ok      gevent  17.768s # 112t 0e 0f 0s

After:

(neo) (z-dev) (g.env) kirr@deco:~/src/tools/go/pygolang$ nxdtest

    >>> thread
    $ python -m pytest
    ============================= test session starts ==============================
    platform linux2 -- Python 2.7.18, pytest-4.6.11, py-1.9.0, pluggy-0.13.1
    rootdir: /home/kirr/src/tools/go/pygolang
    collected 112 items

    golang/_gopath_test.py ..                                                [  1%]
    golang/context_test.py ..                                                [  3%]
    golang/cxx_test.py ..                                                    [  5%]
    golang/errors_test.py ........                                           [ 12%]
    golang/fmt_test.py ...                                                   [ 15%]
    golang/golang_test.py ................................................   [ 58%]
    golang/io_test.py .                                                      [ 58%]
    golang/strconv_test.py ..                                                [ 60%]
    golang/strings_test.py .....                                             [ 65%]
    golang/sync_test.py .............                                        [ 76%]
    golang/time_test.py ........                                             [ 83%]
    golang/pyx/build_test.py ...                                             [ 86%]
    golang/pyx/runtime_test.py .                                             [ 87%]
    gpython/gpython_test.py ssssss.sssssss                                   [100%]

    ==================== 99 passed, 13 skipped in 5.27 seconds =====================
    ok      thread  5.508s  # 112t 0e 0f 13s

    >>> gevent
    $ gpython -m pytest
    ============================= test session starts ==============================
    platform linux2 -- Python 2.7.18, pytest-4.6.11, py-1.9.0, pluggy-0.13.1
    rootdir: /home/kirr/src/tools/go/pygolang
    collected 112 items

    golang/_gopath_test.py ..                                                [  1%]
    golang/context_test.py ..                                                [  3%]
    golang/cxx_test.py ..                                                    [  5%]
    golang/errors_test.py ........                                           [ 12%]
    golang/fmt_test.py ...                                                   [ 15%]
    golang/golang_test.py ................................................   [ 58%]
    golang/io_test.py .                                                      [ 58%]
    golang/strconv_test.py ..                                                [ 60%]
    golang/strings_test.py .....                                             [ 65%]
    golang/sync_test.py .............                                        [ 76%]
    golang/time_test.py ........                                             [ 83%]
    golang/pyx/build_test.py ...                                             [ 86%]
    golang/pyx/runtime_test.py .                                             [ 87%]
    gpython/gpython_test.py ..............                                   [100%]

    ========================= 112 passed in 17.32 seconds ==========================
    ok      gevent  17.729s # 112t 0e 0f 0s
parent 1561b3a0
......@@ -152,6 +152,11 @@ def main():
t = tenv.byname[test_result_line.name]
tstart = time()
print('\n>>> %s' % t.name)
eadj = t.kw.get('envadj', {})
sadj = ' '.join(['%s=%s' % (k,eadj[k]) for k in sorted(eadj.keys())])
print('$ %s%s' % (' '.join(t.argv), ' # '+sadj if sadj else ''))
# default status dict
status = {
'test_count': 1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment