oamg / leapp

Leapp - Application & OS Modernization Framework (For in-place upgrades, follow leapp-repository)
https://oamg.github.io/leapp/
Apache License 2.0
87 stars 70 forks source link

Convention for naming unit tests #774

Open Jakuje opened 2 years ago

Jakuje commented 2 years ago

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.

pirat89 commented 2 years ago

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