Comment 7 for bug 1676989

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to oslo.config (master)

Reviewed: https://review.opendev.org/451933
Committed: https://git.openstack.org/cgit/openstack/oslo.config/commit/?id=ec84eeda526adc20dcabdf6e704958cc06773dd3
Submitter: Zuul
Branch: master

commit ec84eeda526adc20dcabdf6e704958cc06773dd3
Author: Dolph Mathews <email address hidden>
Date: Thu Mar 30 17:56:13 2017 +0000

    Refactor unit tests for CLI usage

    Prior to this change, CLI usage was hardcoded into the config opt
    fixture used for all tests. That CLI usage described two required
    positional arguments that were not actually part of the argument parser
    (FOO and BAR), but were instead just made up to have a valid-looking
    usage description.

    The trouble is that you can't then extend that argument parser with
    additional real arguments, and then test the configuration of those
    arguments by inspecting the *real* usage and --help output from
    argparse. For example, a unit test could not assert whether argparse was
    configured correctly by oslo.config, because there's simply no way to
    know when the usage was just statically set to the arbitrary values of
    "FOO BAR."

    This patch moves that specific unit test coverage (overriding usage with
    something arbitrary) into a dedicated unit test, while removing the
    arbitrary usage from all other unit tests. Instead, those unit tests now
    make assertions against the argparser's real configuration, hence
    options like --config-dir and --config-file now appear in those tests,
    because those options are included in every instance of
    cfg.ConfigOpts().

    Change-Id: I54ba989768d074a5f24897299c85bd35fa1cbd1a
    Related-Bug: 1676989