• Georges Racinet's avatar
    WIP demo testhelpers: translating a half of test-revset.t · 29a04e45242e
    Georges Racinet authored
    This corresponds to test-revset.t until this comment:
    "Test smartset.slice() by first/last()"
    
    On my workstation, the truncated test-revset.t takes 25-30 seconds to run:
    
        $ time ./run-tests.py -l test-revset.t
        running 1 tests using 1 parallel processes
        .
        # Ran 1 tests, 0 skipped, 0 failed.
        ./run-tests.py -l test-revset.t  28.51s user 4.03s system 98% cpu 32.869 total
    
    This translation runs in 0.3 seconds
    
        (venv3) ~/heptapod/hdk/default/py-heptapod $ pytest heptapod/tests/test_demo_testhelpers_revset.py
        =========================== test session starts ===========================
        platform linux -- Python 3.8.6, pytest-3.10.1, py-1.9.0, pluggy-0.13.1
        rootdir: /home/gracinet/heptapod/hdk/default/py-heptapod, inifile: pytest.ini
        plugins: cov-2.6.0, grpc-0.8.0
        collected 1 item
    
        heptapod/tests/test_demo_testhelpers_revset.py .                    [100%]
    
        ============================ warnings summary =============================
        heptapod/tests/test_demo_testhelpers_revset.py::test_revset
          /home/gracinet/heptapod/hdk/default/venv3/lib/python3.8/site-packages/mercurial/utils/stringutil.py:635: DeprecationWarning: invalid escape sequence '\d'
            return codecs.escape_decode(s)[0]
          /home/gracinet/heptapod/hdk/default/venv3/lib/python3.8/site-packages/mercurial/utils/stringutil.py:635: DeprecationWarning: invalid escape sequence '\d'
            return codecs.escape_decode(s)[0]
    
        -- Docs: https://docs.pytest.org/en/latest/warnings.html
        ================== 1 passed, 2 warnings in 0.28 seconds ===================
    
    Remarks and caveats:
    
      - we're not making assertions about internal representation of the revsets,
        especially to check optimizations. Arguably, these could belong to another
        test case
      - ignored tests related to `r3232`. Don't expect them to be a problem.
      - time to run was almost the same with only a dozen assertions. Could mean
        that most of the time is spent in the fixture. On the other side, the
        truncated `test-revset.t` is faster than the whole (28s vs 59s).
    29a04e45242e
test_demo_testhelpers_revset.py 18.9 KB