files.new_contents: 
  ======================
      Examples
  ======================
  
  Let's have a look at a couple of real-life examples!
  
  You can obtain detailed list of available options for each command
  by invoking it with ``--help``. To control the verbosity of the
  output, use ``--debug`` and ``--quiet``. Depending on the command,
  ``--verbose`` might be also available.
  
  Simply run ``tmt`` to get started with exploring your working
  directory::
  
      $ tmt
      Found 2 tests: /tests/docs and /tests/ls.
      Found 3 plans: /plans/basic, /plans/helps and /plans/smoke.
      Found 109 stories: /spec/core/description, /spec/core/order,
      /spec/core/summary, /spec/plans/artifact, /spec/plans/gate,
      /spec/plans/summary, /spec/steps/discover and 103 more.
  
  
  
  Init
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
  Before starting a new project initialize the metadata tree root::
  
      $ tmt init
      Tree '/tmp/try' initialized.
      To populate it with example content, use --template with mini, base or full.
  
  You can also populate it with a minimal plan example::
  
      $ tmt init --template mini
      Tree '/tmp/try' initialized
  
  [... the rest is omitted ...]
files.new_path: docs/examples.rst
files.old_contents: 
  ======================
      Examples
  ======================
  
  Let's have a look at a couple of real-life examples!
  
  You can obtain detailed list of available options for each command
  by invoking it with ``--help``. To control the verbosity of the
  output, use ``--debug`` and ``--quiet``. Depending on the command,
  ``--verbose`` might be also available.
  
  Simply run ``tmt`` to get started with exploring your working
  directory::
  
      $ tmt
      Found 2 tests: /tests/docs and /tests/ls.
      Found 3 plans: /plans/basic, /plans/helps and /plans/smoke.
      Found 109 stories: /spec/core/description, /spec/core/order,
      /spec/core/summary, /spec/plans/artifact, /spec/plans/gate,
      /spec/plans/summary, /spec/steps/discover and 103 more.
  
  
  
  Init
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
  Before starting a new project initialize the metadata tree root::
  
      $ tmt init
      Tree '/tmp/try' initialized.
      To populate it with example content, use --template with mini, base or full.
  
  You can also populate it with a minimal plan example::
  
      $ tmt init --template mini
      Tree '/tmp/try' initialized
  
  [... the rest is omitted ...]
files.old_path: docs/examples.rst
files.new_contents: story: 'As a user I want to comfortably work with plans'
  
  /ls:
      story: 'List available plans'
      example: tmt plan ls
      implemented: /tmt/cli
      tested: /tests/ls
      documented: /docs/examples#explore-plans
  
  /show:
      story: 'Show plan configuration'
      example: tmt plan show
      implemented: /tmt/cli
      documented: /docs/examples#explore-plans
  
  /filter:
      story: 'Filter available plans'
      description:
          Search plans using a regular expression or a filter.
          Use ``.`` to select plans under the current directory.
      example:
          - tmt plan ls .
          - tmt plan ls REGEXP
          - tmt plan show --filter artifact:build
      implemented: /tmt/base.py
      documented: /docs/examples#explore-plans
  
  /lint:
      story: 'Check plan against the L2 metadata specification'
      description:
          Verify that plan metadata are aligned with the
          specification, e.g. that all required attributes are
          present and that all attributes have correct type.
      example: tmt plan lint
      implemented: /tmt/cli
  
  /create:
      story: 'As a developer I want to easily enable CI'
      description:
          Provide a
  
  [... the rest is omitted ...]
files.new_path: stories/cli/plan.fmf
files.old_contents: story: 'As a user I want to comfortably work with plans'
  
  /ls:
      story: 'List available plans'
      example: tmt plan ls
      implemented: /tmt/cli
      tested: /tests/ls
      documented: /docs/examples#explore-plans
  
  /show:
      story: 'Show plan configuration'
      example: tmt plan show
      implemented: /tmt/cli
      documented: /docs/examples#explore-plans
  
  /filter:
      story: 'Filter available plans'
      example:
          - tmt plan ls REGEXP
          - tmt plan show --filter artifact:build
      implemented: /tmt/base.py
      documented: /docs/examples#explore-plans
  
  /lint:
      story: 'Check plan against the L2 metadata specification'
      description:
          Verify that plan metadata are aligned with the
          specification, e.g. that all required attributes are
          present and that all attributes have correct type.
      example: tmt plan lint
      implemented: /tmt/cli
  
  /create:
      story: 'As a developer I want to easily enable CI'
      description:
          Provide a super-easy and user-friendly way how to
          enable tests in the CI. Several templates should be
          supported to cover common use cases.
      example:
         
  
  [... the rest is omitted ...]
files.old_path: stories/cli/plan.fmf
files.new_contents: story: 'As a developer I want to comfortably work with stories'
  
  /ls:
      story: 'List available stories'
      example: tmt story ls
      implemented: /tmt/cli
      tested: /tests/ls
      documented: /docs/examples#explore-stories
  
  /show:
      story: 'Show story details'
      example: tmt story show
      implemented: /tmt/cli
      documented: /docs/examples#explore-stories
  
  /filter:
      story: 'Search available stories'
      description:
          Search stories using a regular expression, a filter or
          coverage status. Use ``.`` to select stories under the
          current directory.
      example:
          - tmt story ls .
          - tmt story ls REGEXP
          - tmt story ls --implemented
          - tmt story ls --unimplemented
          - tmt story ls --tested
          - tmt story ls --untested
          - tmt story ls --documented
          - tmt story ls --undocumented
      implemented: /tmt/cli
      documented: /docs/examples#filter-stories
  
  /create:
      story: 'As a developer I want to easily create new story.'
      description:
          Provide an easy way how to create a new story.
          Several templates should
  
  [... the rest is omitted ...]
files.new_path: stories/cli/story.fmf
files.old_contents: story: 'As a developer I want to comfortably work with stories'
  
  /ls:
      story: 'List available stories'
      example: tmt story ls
      implemented: /tmt/cli
      tested: /tests/ls
      documented: /docs/examples#explore-stories
  
  /show:
      story: 'Show story details'
      example: tmt story show
      implemented: /tmt/cli
      documented: /docs/examples#explore-stories
  
  /filter:
      story: 'Search available stories'
      example:
          - tmt story --implemented
          - tmt story --unimplemented
          - tmt story --tested
          - tmt story --untested
          - tmt story --documented
          - tmt story --undocumented
      implemented: /tmt/cli
      documented: /docs/examples#filter-stories
  
  /create:
      story: 'As a developer I want to easily create new story.'
      description:
          Provide an easy way how to create a new story.
          Several templates should be provided to choose from.
      example:
          - tmt story create /stories/area/story
          - tmt story create /stories/area/story --template mini
          - tmt story create /stories/area/story --template
  
  [... the rest is omitted ...]
files.old_path: stories/cli/story.fmf
files.new_contents: story: 'As a user I want to comfortably work with tests'
  
  /ls:
      story: 'List available tests'
      example: tmt test ls
      implemented: /tmt/cli
      tested: /tests/ls
      documented: /docs/examples#explore-tests
  
  /show:
      story: 'Show test metadata'
      example: tmt test show
      implemented: /tmt/cli
      documented: /docs/examples#explore-tests
  
  /lint:
      story: 'Check test against the L1 metadata specification'
      description:
          Verify that test metadata are aligned with the
          specification, e.g. that all required attributes are
          present and that all attributes have correct type.
      example: tmt test lint
      implemented: /tmt/cli
      documented: /docs/examples#lint-tests
  
  /create:
      story: 'Create a new test skeleton'
      description:
          Provide an easy way how to create a new test. Ideally
          with support for multiple test skeletons. Similarly as
          beaker-wizard (which should be obsoleted by this) the
          tool should prompt for required values if not provided
          on the command line.
      example:
          - tmt test create
          - tmt test create /tests/area/feature
          - tmt
  
  [... the rest is omitted ...]
files.new_path: stories/cli/test.fmf
files.old_contents: story: 'As a user I want to comfortably work with tests'
  
  /ls:
      story: 'List available tests'
      example: tmt test ls
      implemented: /tmt/cli
      tested: /tests/ls
      documented: /docs/examples#explore-tests
  
  /show:
      story: 'Show test metadata'
      example: tmt test show
      implemented: /tmt/cli
      documented: /docs/examples#explore-tests
  
  /lint:
      story: 'Check test against the L1 metadata specification'
      description:
          Verify that test metadata are aligned with the
          specification, e.g. that all required attributes are
          present and that all attributes have correct type.
      example: tmt test lint
      implemented: /tmt/cli
      documented: /docs/examples#lint-tests
  
  /create:
      story: 'Create a new test skeleton'
      description:
          Provide an easy way how to create a new test. Ideally
          with support for multiple test skeletons. Similarly as
          beaker-wizard (which should be obsoleted by this) the
          tool should prompt for required values if not provided
          on the command line.
      example:
          - tmt test create
          - tmt test create /tests/area/feature
          - tmt
  
  [... the rest is omitted ...]
files.old_path: stories/cli/test.fmf
files.new_contents: # coding: utf-8
  
  """ Base Metadata Classes """
  
  import os
  import re
  import fmf
  import pprint
  
  import tmt.steps
  import tmt.utils
  import tmt.templates
  
  import tmt.steps.discover
  import tmt.steps.provision
  import tmt.steps.prepare
  import tmt.steps.execute
  import tmt.steps.report
  import tmt.steps.finish
  
  from tmt.utils import verdict
  from fmf.utils import listed
  from click import echo, style
  
  
  class Node(tmt.utils.Common):
      """
      General node object
  
      Corresponds to given fmf.Tree node.
      Implements common Test, Plan and Story methods.
      """
  
      # Supported attributes
      _keys = ['name']
  
      def __init__(self, node, parent=None):
          """ Initialize the node """
          super(Node, self).__init__(parent=parent, name=node.name)
          self.node = node
  
      def __str__(self):
          """ Node name """
          return self.name
  
      def _sources(self):
          """ Show source files """
          echo(tmt.utils.format(
              'sources', self.node.sources, key_color='magenta'))
  
      @classmethod
      def _save_context(cls, context):
          """ Save provided command line context for future use """
         
  
  [... the rest is omitted ...]
files.new_path: tmt/base.py
files.old_contents: # coding: utf-8
  
  """ Base Metadata Classes """
  
  import os
  import re
  import fmf
  import pprint
  
  import tmt.steps
  import tmt.utils
  import tmt.templates
  
  import tmt.steps.discover
  import tmt.steps.provision
  import tmt.steps.prepare
  import tmt.steps.execute
  import tmt.steps.report
  import tmt.steps.finish
  
  from tmt.utils import verdict
  from fmf.utils import listed
  from click import echo, style
  
  
  class Node(tmt.utils.Common):
      """
      General node object
  
      Corresponds to given fmf.Tree node.
      Implements common Test, Plan and Story methods.
      """
  
      # Supported attributes
      _keys = ['name']
  
      def __init__(self, node, parent=None):
          """ Initialize the node """
          super(Node, self).__init__(parent=parent, name=node.name)
          self.node = node
  
      def __str__(self):
          """ Node name """
          return self.name
  
      def _sources(self):
          """ Show source files """
          echo(tmt.utils.format(
              'sources', self.node.sources, key_color='magenta'))
  
      def name_and_summary(self):
          """ Node name and optional summary """
          if self.summary:
              return '{0
  
  [... the rest is omitted ...]
files.old_path: tmt/base.py
files.new_contents: # coding: utf-8
  
  """ Command line interface for the Test Management Tool """
  
  from click import echo, style
  from fmf.utils import listed
  
  import click
  import os
  
  import fmf
  import tmt
  import tmt.utils
  import tmt.convert
  import tmt.steps
  import tmt.templates
  
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  #  Custom Group
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
  class CustomGroup(click.Group):
      """ Custom Click Group """
  
      def list_commands(self, context):
          """ Prevent alphabetical sorting """
          return self.commands.keys()
  
      def get_command(self, context, cmd_name):
          """ Allow command shortening """
          # Backward-compatible 'test convert' (just temporary for now FIXME)
          cmd_name = cmd_name.replace('convert', 'import')
          # Support both story & stories
          cmd_name = cmd_name.replace('story', 'stories')
          found = click.Group.get_command(self, context, cmd_name)
          if found is not None:
              return found
          matches = [command for command in self.list_commands(context)
                     if command.startswith(cmd_name)]
          if not matches:
              return None
          elif len(matches) == 1:
              return click.Group.get_command(self, context, matches[0])
          context.fail('Did
  
  [... the rest is omitted ...]
files.new_path: tmt/cli.py
files.old_contents: # coding: utf-8
  
  """ Command line interface for the Test Management Tool """
  
  from click import echo, style
  from fmf.utils import listed
  
  import click
  import os
  
  import fmf
  import tmt
  import tmt.utils
  import tmt.convert
  import tmt.steps
  import tmt.templates
  
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  #  Custom Group
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
  class CustomGroup(click.Group):
      """ Custom Click Group """
  
      def list_commands(self, context):
          """ Prevent alphabetical sorting """
          return self.commands.keys()
  
      def get_command(self, context, cmd_name):
          """ Allow command shortening """
          # Backward-compatible 'test convert' (just temporary for now FIXME)
          cmd_name = cmd_name.replace('convert', 'import')
          # Support both story & stories
          cmd_name = cmd_name.replace('story', 'stories')
          found = click.Group.get_command(self, context, cmd_name)
          if found is not None:
              return found
          matches = [command for command in self.list_commands(context)
                     if command.startswith(cmd_name)]
          if not matches:
              return None
          elif len(matches) == 1:
              return click.Group.get_command(self, context, matches[0])
          context.fail('Did
  
  [... the rest is omitted ...]
files.old_path: tmt/cli.py
files.new_contents: # coding: utf-8
  
  """ Test Metadata Utilities """
  
  from click import style, echo, wrap_text
  
  from collections import OrderedDict
  import unicodedata
  import subprocess
  import fmf.utils
  import pprint
  import shlex
  import select
  import yaml
  import re
  import io
  import os
  
  log = fmf.utils.Logging('tmt').logger
  
  # Default workdir root and max
  WORKDIR_ROOT = '/var/tmp/tmt'
  WORKDIR_MAX = 1000
  
  # Hierarchy indent
  INDENT = 4
  
  # Simple runner script name
  RUNNER = 'run.sh'
  
  
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  #  Common
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
  class Common(object):
      """
      Common shared stuff
  
      Takes care of command line context and workdir handling.
      """
  
      # Command line context, workdir and status
      _context = None
      _workdir = None
  
      def __init__(self, parent=None, name=None):
          """ Initialize name and relation with the parent object """
          # Use lowercase class name as the default name
          self.name = name or self.__class__.__name__.lower()
          self.parent = parent
  
      def __str__(self):
          """ Name is the default string representation """
          return self.name
  
      @classmethod
      def
  
  [... the rest is omitted ...]
files.new_path: tmt/utils.py
files.old_contents: # coding: utf-8
  
  """ Test Metadata Utilities """
  
  from click import style, echo, wrap_text
  
  from collections import OrderedDict
  import unicodedata
  import subprocess
  import fmf.utils
  import pprint
  import shlex
  import select
  import yaml
  import re
  import io
  import os
  
  log = fmf.utils.Logging('tmt').logger
  
  # Default workdir root and max
  WORKDIR_ROOT = '/var/tmp/tmt'
  WORKDIR_MAX = 1000
  
  # Hierarchy indent
  INDENT = 4
  
  # Simple runner script name
  RUNNER = 'run.sh'
  
  
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  #  Common
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
  class Common(object):
      """
      Common shared stuff
  
      Takes care of command line context and workdir handling.
      """
  
      # Command line context, workdir and status
      _context = None
      _workdir = None
  
      def __init__(self, parent=None, name=None):
          """ Initialize name and relation with the parent object """
          # Use lowercase class name as the default name
          self.name = name or self.__class__.__name__.lower()
          self.parent = parent
  
      def __str__(self):
          """ Name is the default string representation """
          return self.name
  
      @classmethod
      def
  
  [... the rest is omitted ...]
files.old_path: tmt/utils.py