
We probably want to move to it in ovirt-system-tests as well, to align with both VDSM and Lago itself, no? ---------- Forwarded message ---------- From: Nir Soffer <nsoffer@redhat.com> Date: Thu, Mar 10, 2016 at 3:15 PM Subject: [ovirt-devel] [VDSM] Moving to py.test To: devel <devel@ovirt.org>, Yaniv Bronheim <ybronhei@redhat.com>, Dan Kenigsberg <danken@redhat.com>, Piotr Kliczewski <pkliczew@redhat.com>, Francesco Romani <fromani@redhat.com>, Adam Litke <alitke@redhat.com> Hi all, In the last vdsm call we discussed moving to py.test. Here is how to run the current tests with py.test: cd tests PYTHONPATH=../lib:../vdsm py.test -v *_test.py *_tests.py *Tests.py network Currently we have some failures and errors: 8 failed, 1662 passed, 101 skipped, 14 pytest-warnings, 10 error in 86.05 seconds Some py.test nice tricks: Finding the 10 slowest tests: PYTHONPATH=../lib:../vdsm py.test -v --durations=10 vmTests.py *_test.py *_tests.py *Tests.py network Checking code coverage: PYTHONPATH=../lib:../vdsm py.test -v --cov=../vdsm --cov=vdsm *_test.py *_tests.py *Tests.py network Once we finish moving vdsm code to lib/vdsm, renaming the tests to *_test.py, and add pytest.ini, running the test will be simply: py.test Once all the tests pass, we can: - Drop all the special asserts (assertXXX), py.test uses plain asserts https://pytest.org/latest/assert.html#asserting-with-the-assert-statement - Get better error reports https://pytest.org/latest/example/reportingdemo.html - Remove unneeded classes, or inherit from any class https://pytest.org/latest/getting-started.html - Replace @permutations with more powerfull @pytest.mark.parametrize https://pytest.org/latest/parametrize.html#parametrize-basics - Replace slowtest and stresstest with @pytest.mark https://pytest.org/latest/mark.html - Replace monkeypatch.py with simpler and more powerfull pytest monkeypatch funcarg https://pytest.org/latest/monkeypatch.html#monkeypatching-mocking-modules-an... - Replace NamedTemporaryDir with pytest tmpdir funcarg https://pytest.org/latest/getting-started.html#going-functional-requesting-a... - Simplify complex context managers with pytest fixtures https://pytest.org/latest/example/simple.html - Drop testrunner.py, most of testlib.py, some of testValidation.py, run_tests*.sh - And more Nir _______________________________________________ Devel mailing list Devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/devel