1. 06 10月, 2017 2 次提交
    • C
      selftests/unit/test_distro.py: port from flexmock to mock (unittest.mock) · 2a4e9a85
      Cleber Rosa 提交于
      The first line says it all, this is a pretty straightforward port.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      2a4e9a85
    • C
      selftests/unit/test_remote.py: port from flexmock to mock (unittest.mock) · 5a147faf
      Cleber Rosa 提交于
      This is a port to the mock library that is in the standard in Python 3, and
      it's available in Python 2, and already a requirement for Avocado.
      
      The approach used on this port is to avoid excessive mocking, and use
      the real code, unless when insteracting with dynamic and non-existing
      components (such as a remote system).
      
      A partial list of the changes when compared to the previous version:
      
      * Args was made into a real argparse.Namespace instance because
        there's no need for it to be a mocked object.  Actually, it is
        better to have an exact object instance, rather than a mock when
        it's possible to.
      
      * The "references" attribute being set on the, then mocked, job instance
        has been dropped, because the natural way of passing that to the job
        is using the "reference" key in args.  Also, while purely cosmetic,
        the references that look like the example instrumented tests have
        been renamed (passtest -> passtest.py).
      
      * The "unique_id" attribute being set on the, then mocked, job instance
        had a value (1-sleeptest;0) completely incompatible with job IDs, and
        was removed from being set manually.
      
      * This version does *not* mock "low level" remote execution of commands,
        such as running "env" or "avocado -v" on the remote host.  Instead, it
        mocks the end result of check_remote_avocado completely.
      
      * The extra test on RemoteTestRunner.setup() seems unnecessary, because
        that is part of the run_suite() workflow.
      
      * Checking if `__init__` was called is not be possible with mock. See
        https://docs.python.org/3/library/unittest.mock.html#mocking-magic-methodsSigned-off-by: NCleber Rosa <crosa@redhat.com>
      5a147faf
  2. 05 10月, 2017 3 次提交
  3. 04 10月, 2017 13 次提交
  4. 03 10月, 2017 4 次提交
  5. 02 10月, 2017 1 次提交
  6. 29 9月, 2017 1 次提交
  7. 28 9月, 2017 6 次提交
    • C
      MANIFEST.in: there are no longer YAML files under examples · c689699e
      Cleber Rosa 提交于
      This fixes the warning "warning: no files found matching
      'examples/*.yaml'" while running "make develop".
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      c689699e
    • C
      Job: do not count on base_logdir when using dry run mode · b459397c
      Cleber Rosa 提交于
      As in previous commits, job should not count on arguments being
      present, such as "base_logdir".  This also needs to be handled
      when using dry run mode.
      
      Since the dry run implementation creates a temporary directory
      itself, it needs to be cleaned up in addition to the tmpdir
      created by setUp.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      b459397c
    • C
      Job: make sure a job can be created without an explicit base_logdir · 33ea34a1
      Cleber Rosa 提交于
      One of the premises of the Job class is that it can be created without
      any mandatory information set in the args parameter.  But, because of
      the way we're testing it, we always pass a base_logdir.
      
      This test is about making sure the job gets a base_logdir, and
      consequently a logdir, even when a base_logdir is not set in the args.
      The implementation of this test is based on the fact that there's
      already a tmpdir that can be used for playing the role of a base_logdir.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      33ea34a1
    • C
      Job: do not assume a unique_job_id exists when using dry run mode · 69bf621c
      Cleber Rosa 提交于
      We already handle the lack of a unique_job_id in a job, but when
      using dry run, the check is not being done in a way that waives
      that requirement.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      69bf621c
    • C
      Job: distinguish between the base log dir and the job logdir itself · 23ce2269
      Cleber Rosa 提交于
      The Job class code uses the same name, logdir, for both the directory
      that will hold a given job's results (job-<timestamp>-<shortid>) and
      the base directory, where the first one will be created.
      
      This changes the naming so that the base log dir, only present in
      the job arguments (the argparse.Namespace instance) will be named
      "base_logdir".  The job's result dir, which value is kept in the
      job instance itself, is still named "logdir".
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      23ce2269
    • C
      yaml_to_mux: optimize the check for the debug option · 80ebf8ba
      Cleber Rosa 提交于
      In theory, the option will always be set when running a job with the
      accompanying "CLI" plugin enabled.  In practice, some of the selftests
      create Job instances, and the "mux_debug" option may not be present.
      
      The exact error that occurs in these situations is:
      
      ERROR| Reproduced traceback from: [...]/avocado/core/dispatcher.py:255
      ERROR| Traceback (most recent call last):
      ERROR|   File "[...]/optional_plugins/varianter_yaml_to_mux/avocado_varianter_yaml_to_mux/__init__.py", line 416, in initialize
      ERROR|     if args.avocado_variants.debug:
      ERROR| AttributeError: 'Namespace' object has no attribute 'avocado_variants'
      ERROR|
      ERROR| Error running method "initialize" of plugin "yaml_to_mux": 'Namespace' object has no attribute 'avocado_variants'
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      80ebf8ba
  8. 27 9月, 2017 4 次提交
  9. 21 9月, 2017 3 次提交
  10. 20 9月, 2017 2 次提交
  11. 19 9月, 2017 1 次提交