[lago-devel] Fwd: [ovirt-devel] [VDSM] Moving to py.test

David Caro dcaro at redhat.com
Thu Mar 10 14:51:01 UTC 2016


On 03/10 16:47, Yaniv Kaul wrote:
> We probably want to move to it in ovirt-system-tests as well, to align with
> both VDSM and Lago itself, no?


Nose is still hardcoded in lago's ovirt pulgin, we must change that in order to
be able to use it (well, pytest should be able to run nose tests, but we have
some nose custom plugins that I don't think will work).


> 
> ---------- Forwarded message ----------
> From: Nir Soffer <nsoffer at redhat.com>
> Date: Thu, Mar 10, 2016 at 3:15 PM
> Subject: [ovirt-devel] [VDSM] Moving to py.test
> To: devel <devel at ovirt.org>, Yaniv Bronheim <ybronhei at redhat.com>, Dan
> Kenigsberg <danken at redhat.com>, Piotr Kliczewski <pkliczew at redhat.com>,
> Francesco Romani <fromani at redhat.com>, Adam Litke <alitke at 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-and-environments
> 
> - Replace NamedTemporaryDir with pytest tmpdir funcarg
> 
> https://pytest.org/latest/getting-started.html#going-functional-requesting-a-unique-temporary-directory
> 
> - 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 at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/devel

> _______________________________________________
> lago-devel mailing list
> lago-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/lago-devel


-- 
David Caro

Red Hat S.L.
Continuous Integration Engineer - EMEA ENG Virtualization R&D

Tel.: +420 532 294 605
Email: dcaro at redhat.com
IRC: dcaro|dcaroest@{freenode|oftc|redhat}
Web: www.redhat.com
RHT Global #: 82-62605
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.ovirt.org/pipermail/lago-devel/attachments/20160310/cc497115/attachment-0001.sig>


More information about the lago-devel mailing list