Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convention for naming unit tests #774

Open
Jakuje opened this issue May 18, 2022 · 1 comment
Open

Convention for naming unit tests #774

Jakuje opened this issue May 18, 2022 · 1 comment
Labels

Comments

@Jakuje
Copy link
Contributor

Jakuje commented May 18, 2022

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 Jakuje added the bug label May 18, 2022
@pirat89 pirat89 added docs and removed bug labels May 19, 2022
@pirat89
Copy link
Member

pirat89 commented May 19, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants