Wireshark-commits: [Wireshark-commits] master 54d7e96: test: make it possible to use pytest-style t

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Fri, 09 Nov 2018 05:03:18 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=54d7e96a72e5871792b1e0c1c29f6fd1ac0743c0
Submitter: "Anders Broman <a.broman58@xxxxxxxxx>"
Changed: branch: master
Repository: wireshark

Commits:

54d7e96 by Peter Wu (peter@xxxxxxxxxxxxx):

    test: make it possible to use pytest-style test fixtures
    
    Currently all binaries must be available or no tests will be executed.
    This is inconvenient if you just want to test a single binary (e.g.
    text2pcap) without having to build epan. The problem is essentially that
    tests lack dependency annotations.
    
    To solve this problem, add the required dependencies as parameters to
    each test (so-called 'fixtures' in pytest). Skip a test if a binary
    (such as tshark) is unavailable. As a demonstration, suite_dissection.py
    is converted. Over time, tests should no longer depend on config.py due
    to explicit dependencies fixtures (listed in fixtures_ws.py).
    
    Since the unittest module does not support such dependency injections,
    create a small glue for use with pytest and an (incomplete) emulation
    layer for use with test.py.
    
    Tested with pytest 3.8.2 + Python 3.7.0 and pytest 3.0.3 + Python 3.4.3.
    Python 2.7 is not supported and will fail. Test commands:
    
        ~/wireshark/test/test.py -p ~/build/run
        WS_BIN_PATH=~/build/run pytest ~/wireshark/test -ra
    
    Change-Id: I6dc8c28f5c8b7bbc8f4c04838e9bf085cd22eb0b
    Ping-Bug: 14949
    Reviewed-on: https://code.wireshark.org/review/30220
    Tested-by: Petri Dish Buildbot
    Petri-Dish: Peter Wu <peter@xxxxxxxxxxxxx>
    Reviewed-by: Anders Broman <a.broman58@xxxxxxxxx>
    

Actions performed:

    from  e0ac913   GTP: fix NR user plane DL data delivery status
     add  54d7e96   test: make it possible to use pytest-style test fixtures


Summary of changes:
 test/config.py           |   8 +-
 test/conftest.py         |   6 +-
 test/fixtures.py         | 337 +++++++++++++++++++++++++++++++++++++++++++++++
 test/fixtures_ws.py      | 174 ++++++++++++++++++++++++
 test/subprocesstest.py   |   8 ++
 test/suite_dissection.py |  54 ++++----
 test/test.py             |  10 +-
 7 files changed, 562 insertions(+), 35 deletions(-)
 create mode 100644 test/fixtures.py
 create mode 100644 test/fixtures_ws.py