1. 12 10月, 2017 1 次提交
    • L
      output: Adjust LoggingFile to work with raw output · e4b5ee05
      Lukáš Doktor 提交于
      The 4235b329 changed the
      stdout/stderr/output logging handlers to not to add tailing '\n's, but
      these are processed by LoggingFile, which is designed to remove the
      '\n's and to logged them per line. As a result the unittest was
      incorrectly changed as the first outputs actually add the '\n' which was
      removed in the expected output.
      
      This patch keeps the raw approach as it is necessary for the last
      buffered line and instead of buffering puts all lines including the
      tailing '\n' and not '\n' for the remaining last line (if it's
      available). Consequently this should improve the situation where output
      is being produced by stderr and stdout concurrently as no buffering of
      the non-tailing-newline output is done on LoggingFile level.
      Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
      e4b5ee05
  2. 11 10月, 2017 7 次提交
  3. 10 10月, 2017 2 次提交
  4. 09 10月, 2017 1 次提交
  5. 06 10月, 2017 12 次提交
    • L
      Merging pull request 2246 · dc6e855f
      Lukáš Doktor 提交于
      Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
      
      * https://github.com/avocado-framework/avocado:
        Project infrastructure removal of flexmock
        selftests/unit/test_vm.py: port from flexmock to mock
        selftests/unit/test_utils_partition.py: port TestMtabLock.test_lock to mock
        selftests/unit/test_test.py: port test_all_dirs_exists_no_hang to mock
        selftests/unit/test_test.py: remote flexmock requirement of test_long_name
        selftests/unit/test_datadir.py: port test_settings_dir_alternate_dynamic to mock
        selftests/unit/test_datadir.py: port test_unique_log_dir to mock
        selftests/unit/test_datadir.py: port test_datadir_from_config to mock
        selftests/unit/test_distro.py: port from flexmock to mock (unittest.mock)
        selftests/unit/test_remote.py: port from flexmock to mock (unittest.mock)
        RemoteTestRunner: fix description of setup() method
      dc6e855f
    • C
      Project infrastructure removal of flexmock · e4af4be4
      Cleber Rosa 提交于
      This commit revomes flexmock from the various requirements file, from
      the RPM SPEC file.  Starting here, it's officially no longer an
      Avocado dependency.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      e4af4be4
    • C
      selftests/unit/test_vm.py: port from flexmock to mock · 3f4140a6
      Cleber Rosa 提交于
      The approach used on this port is to avoid excessive mocking, like the
      test_remote.py port, and use the real code, unless when insteracting
      with dynamic and non-existing components (such as a the hypervisor or
      running domain).
      
      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).
      
      * Removal of JSON_RESULTS, which was not being used in the test.
      
      * Use dry_run and clean up job results.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      3f4140a6
    • C
      selftests/unit/test_utils_partition.py: port TestMtabLock.test_lock to mock · 3eae07b1
      Cleber Rosa 提交于
      And remove module flexmock requirements.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      3eae07b1
    • C
      selftests/unit/test_test.py: port test_all_dirs_exists_no_hang to mock · 2fef8fdb
      Cleber Rosa 提交于
      And remove the requirement on flexmock on this module.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      2fef8fdb
    • C
      selftests/unit/test_test.py: remote flexmock requirement of test_long_name · 4accc18a
      Cleber Rosa 提交于
      Basically, this is not about switching to mock instead, because
      mocking properties is more challeging with mock, and mocking
      a property of an existing instance is, to the best of my knowledge,
      not possible.
      
      So, it seemed like a good idea to use a different test class with an
      overloaded property that returns the fake filename, and while at it,
      separate split that into two other tests.
      
      It should be easier to understand what each block (now a test) is
      about.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      4accc18a
    • C
      selftests/unit/test_datadir.py: port test_settings_dir_alternate_dynamic to mock · cffba44d
      Cleber Rosa 提交于
      Pretty straightforward port, not really any remarks besides another
      test file becoming flexmock free.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      cffba44d
    • C
      selftests/unit/test_datadir.py: port test_unique_log_dir to mock · af513a3f
      Cleber Rosa 提交于
      Besides the obvious port, I reckon that using a more obvious fake
      return value for the return of `time.strftime` improves the legibility
      of the test.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      af513a3f
    • C
      selftests/unit/test_datadir.py: port test_datadir_from_config to mock · a73716c6
      Cleber Rosa 提交于
      The context manager feature of mock.patch replaces a lot of the code
      that restores the original state.  Besides that, one explicit assert
      was added to make sure that the non-patched state is what we expect.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      a73716c6
    • 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
    • C
      Python 3: make the subcommands sub parser a required option · 3b230a94
      Cleber Rosa 提交于
      The goal of this change is to make the behavior of the Avocado command
      line application as similar as possible to the behavior when running
      under Python 2.  This bit is about what happens when the simplest
      possible Avocado command line is run:
      
       $ avocado
      
      On Python 2, it prints the complete usage, along with the error
      message "too few arguments".  While we could go employ extreme changes
      to make the very same error message be given on Python 3, this seems
      wrong.  The reason is that the message is generated by the Python 2
      standard library.  The Python 3 standard library relies on "required"
      arguments instead.  When settings the subcommand sub parser as a
      required option, the behavior is exactly the same, minus the error
      message which becomes "the following arguments are required:
      subcommand".
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      3b230a94
  6. 05 10月, 2017 5 次提交
  7. 04 10月, 2017 12 次提交