Skip to content

Convention for naming unit tests #774

Description

@Jakuje

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions