oamg/leapp

Convention for naming unit tests

Jakuje opened this issue · 1 comments

Actual behavior
The documentation mentions on several places that the unit tests should be named as test_unit_*, but on some other places as unit_test_*. It is not clear which naming is the correction one and which to chose when writing new tests.

To Reproduce

$ git grep unit_test_
docs/source/repository-dir-layout.md:            unit_test_actorname.py              # should contain the actor name
docs/source/test-actors.md:- unit_test_*.py
docs/source/test-actors.md:- [Example of unit tests](https://github.com/oamg/leapp-repository/blob/master/repos/system_upgrade/el7toel8/actors/checkbootavailspace/tests/unit_test_checkbootavailspace.py)
docs/source/unit-testing.md:            unit_test_my_actor.py
docs/source/unit-testing.md:            unit_test_my_actor.py
tests/data/workflow-tests/tags/unittestworkflow.py:    name = 'unit_test_workflow'
$ git grep test_unit_
docs/source/deprecation.md:repos/system_upgrade/el7toel8/actors/fooproducer/tests/test_unit_fooproducer.py::test_process PASSED
docs/source/deprecation.md:repos/system_upgrade/el7toel8/actors/fooproducer/tests/test_unit_fooproducer.py::test_process
docs/source/deprecation.md:  /tmp/leapp-repository/repos/system_upgrade/el7toel8/actors/fooproducer/tests/test_unit_fooproducer.py:10: _DeprecationWarningContext: Usage of deprecated Model "Foo"
docs/source/deprecation.md:repos/system_upgrade/el7toel8/actors/fooproducer/tests/test_unit_fooproducer.py::test_process FAILED
docs/source/deprecation.md:repos/system_upgrade/el7toel8/actors/fooproducer/tests/test_unit_fooproducer.py::test_process
docs/source/deprecation.md:  /tmp/leapp-repository/repos/system_upgrade/el7toel8/actors/fooproducer/tests/test_unit_fooproducer.py:13: _DeprecationWarningContext: Usage of deprecated Model "Foo"
docs/source/deprecation.md:repos/system_upgrade/el7toel8/actors/fooproducer/tests/test_unit_fooproducer.py::test_process
docs/source/deprecation.md:  /tmp/leapp-repository/repos/system_upgrade/el7toel8/actors/fooproducer/tests/test_unit_fooproducer.py:10: _DeprecationWarningContext: Usage of deprecated Model "BaseFoo"
docs/source/unit-testing.md:`test_*_{actor_name}.py`. For example: `test_unit_sctpconfigread.py` or

Expected behavior
Documentation suggesting only one option.

  • OS and version: (e.g. Fedora 29 or $ cat /etc/system-release)
  • master

@Jakuje thanks for the report. Both cases should be ok, but you are right that documentation should be consistent.