Majic Projects
Gimmecert
Go to the previous open issue
Go to the previous issue (open or closed)
star_faded.png
Please log in to bookmark issues
icon_project.png Gimmecert / Closed Task GC-17 Refactor CLI command handling and relevant tests
Go to the next issue (open or closed)
Go to the next open issue
This issue has been closed with status "Closed" and resolution "RESOLVED".
Issue basics
  • Type of issue
    Task
  • Category
    Not determined
  • Targetted for
    0.1.0
  • Status
    Closed
  • Progress
  • Priority
    Not determined
User pain
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
Affected by this issue (0)
There are no items
People involved
Times and dates
  • Posted at
  • Last updated
  • Estimated time
    4 hours
  • Time spent
    6 hours
    Click here to see time logged against this issue
Issue details
  • Resolution
    RESOLVED
Attachments (0)
There is nothing attached to this issue
Duplicate issues (0)
This issue does not have any duplicates
Description

At the moment there are just two commands available in the tool, but there are already some drawbacks from the initial design around commands. Mainly:

  • There is no decent way to unit test the output being printed to stdout/stderr.
  • The init command handles the output within the wrapper function, while the server command will produce message and status for wrapper consumer. This is a bit inconsistent.
  • Both init and server commands have its own logic behind returning status and error messages.
  • Testing exit codes is from different commands is cumbersome and lacks consistency.

The following should be done:

  • All command implementations (from the commands module) should accept the standard output and error streams as function parameters. This would help in two ways:
    • Commands can take care of all output, especially since commands "have better idea" of what the output means.
    • It will be easier to unit-test the command output - since it would be as simple as providing an instance of io.StringIO.
  • In turn, all output handling should be removed from the cli module, and the wrappers and main would only take care of passing-in the sys.stdout and sys.stderr.
  • All commands should return an exit code. This would make it simpler to unit-test exit codes.
  • Tests which are manipulating the sys.argv should be restructured/rewritten to adjust for the new layout. This would probably mean moving a lot of tests into test_commands.py.
  • Tests should be updated to ensure that they do not accidentally use non-temporary dedicated directory when generating artifacts. There might be a couple of those that are misbehaving.
Todos (0 / 0)
There are no comments