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

Allow test_loader_name to override test class module #171

Merged
merged 1 commit into from Sep 20, 2016

Conversation

cdent
Copy link
Owner

@cdent cdent commented Sep 20, 2016

When running gabbi by default the pretty name of the test
(displayed in test results) has a 'gabbi.suitemaker' prefix. This
can be disorienting when reviewing result sets or trying to track
those results to where in a code tree the gabbi tests are loaded.

This change allows the module of the test classes that are
dynamically created to be override with the test_loader_name
that is passed in to to the build_tests method. By setting this
to name the test is appropriately situated in its context. The
gist of this change can be seen on the diff to test-limit.sh.

Note that this has also been tested in OpenStack Nova, which
was the source of this need. There tests which were showing up with
the name:

gabbi.suitemaker.test_placement_api_inventory_get_that_inventory.\
  test_request

have become:

nova.tests.functional.api.openstack.placement.\
  test_placement_api.inventory_get_that_inventory.test_request

By default nothing has changed. This change only impact situations where
test_loader_name is used.

/cc @FND @jasonamyers @sdague

When running gabbi by default the pretty name of the test
(displayed in test results) has a 'gabbi.suitemaker' prefix. This
can be disorienting when reviewing result sets or trying to track
those results to where in a code tree the gabbi tests are loaded.

This change allows the __module__ of the test classes that are
dynamically created to be override with the test_loader_name
that is passed in to to the build_tests method. By setting this
to __name__ the test is appropriately situated in its context. The
gist of this change can be seen on the diff to test-limit.sh.

Note that this has also been tested in OpenStack Nova, which
was the source of this need. There tests which were showing up with
the name:

    gabbi.suitemaker.test_placement_api_inventory_get_that_inventory.\
      test_request

have become:

    nova.tests.functional.api.openstack.placement.\
      test_placement_api.inventory_get_that_inventory.test_request

By default nothing has changed. This change only impact situations where
test_loader_name is used.
Copy link
Collaborator

@jasonamyers jasonamyers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is great. I've explained this to others before.

@cdent cdent merged commit 1b9c4df into master Sep 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants