1. 17 2月, 2018 13 次提交
  2. 16 2月, 2018 9 次提交
    • L
      tap: Make warnings more visible · 83add27a
      Lukáš Doktor 提交于
      TAP does not defines WARN(ing) test status, but allows comments. Let's
      simply note the test finished with some warnings which is better than
      nothing.
      Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
      83add27a
    • L
      tap: Report "CANCEL" test status as "SKIP" · 876d3b07
      Lukáš Doktor 提交于
      TAP does not defines nor knows about "CANCEL" test status, it only
      defines "SKIP" and "TODO". Let's map the "CANCEL" test status to "SKIP"
      to comply with the specification.
      Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
      876d3b07
    • C
      text_mux.py: adapt to how Python 3 records type names · 02c3b6e4
      Cleber Rosa 提交于
      Which adds the namespace of the function that created the class.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      02c3b6e4
    • C
      test_mux.py: avoid comparing None with integers · ea0b31b9
      Cleber Rosa 提交于
      Which is OK under Python 2, but not under Python 3.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      ea0b31b9
    • C
      xunit plugin: do not print bytes on stdout · 5e27ebdb
      Cleber Rosa 提交于
      When the xunit plugin is writing to the stdout, we don't want a
      representation of bytes, but the bytes encoded as a string users can
      read.
      
      We're sticking to the 'UTF-8' encoding here because it's already
      hard coded here in the document (as opposed to the encoding the
      user may have set to its stdout).
      
      Before this patch, `avocado run /bin/false --xunit -` results in:
      
      b'<?xml version="1.0" encoding="UTF-8"?>\n<testsuite errors="0" failures="0" name="avocado" skipped="0" tests="1" time="0.018056154251098633" timestamp="2018-02-13 12:34:55.627077">\n\t<testcase classname="SimpleTest" name="1-/bin/true" time="0.018056154251098633"/>\n</testsuite>\n'
      
      After this patch it becomes:
      
      <?xml version="1.0" encoding="UTF-8"?>
      <testsuite errors="0" failures="0" name="avocado" skipped="0" tests="1" time="0.018121719360351562" timestamp="2018-02-13 12:34:15.669379">
              <testcase classname="SimpleTest" name="1-/bin/true" time="0.018121719360351562"/>
      </testsuite>
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      5e27ebdb
    • C
      xunit plugin: fix DOM usage · bfab1c6b
      Cleber Rosa 提交于
      On Python 3, it's not possible to create Elements detached from a
      Document.  The following code fails (later than it should) on Python
      3:
      
         >>> from xml.dom.minidom import Element
         >>> e = Element('foo')
         >>> e.setAttribute('bar', 'baz')
         Traceback (most recent call last):
         File "<stdin>", line 1, in <module>
         File "/usr/lib64/python3.6/xml/dom/minidom.py", line 741, in setAttribute
            attr.ownerDocument = self.ownerDocument
         AttributeError: ownerDocument
      
      Let's create elements within the document, with the `createElement`
      API.  According to the docs "The element is not inserted into the
      document when it is created", so the (unchanged) code that actually puts
      the element in the right place still applies.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      bfab1c6b
    • C
      avocado.utils.iso9660: always deal with bytes · 01c84866
      Cleber Rosa 提交于
      The avocado.utils.process module has been changed so that the content
      of stdout and stderr are now bytes.  The content generated by the
      iso9660 backend implementations should also operate on bytes, given
      that it makes little sense for the library to assume a given content
      type of a file (inside an iso9660 archive).
      
      To make the data returned by the various backend `read()`
      implementations always return bytes on both Python 2 and 3, an
      explicit conversion is done from strings to bytes (which affects only
      Python 2, since Python 3 already operates with bytes on files opened
      in binary mode).
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      01c84866
    • C
      avocado.utils.process: use bytes for raw stdout/stderr · 7d0e6a44
      Cleber Rosa 提交于
      This brings a change in behaviour, in which the stdout/stderr of the
      executed process will now be of bytes type, instead of a string type.
      
      Two new attributes, which are implemented as properties, have been
      added to the CmdResult class, `stdout_text` and `stderr_text`.  Those
      are convenience methods that will return the same content that is in
      `stdout` and `stderr`, reespectively, but decoded on the fly[1].
      
      With regards to encoding, if one is not provided, the result of
      `sys.getdefaultencoding()` will be used ("utf-8" for Python 3 and
      "ascii" for Python 2).
      
      Applications and/or tests using the APIs that return a CmdResult
      should, to the best of my knowledge, set a default encoding themselves
      so a stable behavior across Python versions.  But that if left to
      users of this API.
      
      A different tradeoff/design decision has to do with the tests modified
      here.  One option is to have "text" (as in sequences of human readable
      glyphs) as being of Python type "str".  On Python 2, "str" can be
      compared to "bytes" because a conversion will happen on demand.  That
      is, the following is fine on Python 2:
      
         >>> result = process.run("command")
         >>> "expected" in process.stdout
      
      Where `expected` is of type "str" and `process.stdout` is of type
      "bytes".  This is not true of Python 3, so either the types must match
      or a conversion must be done explicitly.  The solutions to that are:
      
      1) have these "text" as (of type) "bytes" in the source code itself,
         and avoid the conversion whenever possible
      2) have "strings" in the source code itself, and use the conversion
         provided by `CmdResult.stdout_text` and `CmdResult.stderr_text`.
      
      The approach chosen here is to avoid conversion if possible, that is,
      use "byte" types, given the fact that the source code encoding is by
      default 'ascii' and most of the "text" dealt with here can be
      represented in 'ascii' too.  This is equivalent of doing:
      
         result = process.run("command")
         b"expected" in process.stdout
         "errors: %s" % 0 in process.stderr_text
      
      [1] The obvious alternative, instead of decoding these on the fly
          would be to have multiple copies of the "same" data.  This assumes
          that binary data produced on the stdout/stderr will usually be
          larger than textual data.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      7d0e6a44
    • C
      15d436d7
  3. 15 2月, 2018 11 次提交
  4. 14 2月, 2018 3 次提交
  5. 13 2月, 2018 4 次提交
    • P
      fix avocado:utils:distro · e5c8c1b6
      Praveen K Pandey 提交于
      fixed pep8 issue on line no 319
      Signed-off-by: NPraveen K Pandey <praveen@linux.vnet.ibm.com>
      e5c8c1b6
    • P
      Fixed issue in avocado:utils:distro · 099ca9c3
      Praveen K Pandey 提交于
      In SUSE distro distro.detect() is failing as undefined variable
      
      log:
      START 1-generic/sosreport.py:sosreport_test.test;run-cd82
      Test metadata:
        filename: /root/avocado-fvt-wrapper/tests/avocado-misc-tests/generic/sosreport.py
      DATA (filename=output.expected) => NOT FOUND (data sources: variant, test, file)
      
      Reproduced traceback from: /usr/lib/python2.7/site-packages/avocado_framework-58.0-py2.7.egg/avocado/core/test.py:814
      Traceback (most recent call last):
        File "/root/avocado-fvt-wrapper/tests/avocado-misc-tests/generic/sosreport.py", line 42, in setUp
          dist = distro.detect()
        File "/usr/lib/python2.7/site-packages/avocado_framework-58.0-py2.7.egg/avocado/utils/distro.py", line 416, in detect
          distro_result = probe_instance.get_distro()
        File "/usr/lib/python2.7/site-packages/avocado_framework-58.0-py2.7.egg/avocado/utils/distro.py", line 370, in get_distro
          with open(self.check_file) as check_file:
      AttributeError: 'SUSEProbe' object has no attribute 'check_file'
      Signed-off-by: NPraveen K Pandey <praveen@linux.vnet.ibm.com>
      099ca9c3
    • A
      Merge branch 'clebergnu-selftests_and_misc_fixes' · 65e7f84e
      Amador Pahim 提交于
      Signed-off-by: NAmador Pahim <apahim@redhat.com>
      65e7f84e
    • L
      dispatcher: Unify the map_method implementations · 98d4c181
      Lukáš Doktor 提交于
      Currently almost each "Dispatcher" implements it's own "map_method",
      some allow to log tracebacks, some doesn't... Let's implement 2 main
      variants, one simple without reporting the results, the other with
      support for deepcopying of the arguments and returning the list of
      results and use them in all dispatchers.
      
      The main difference against previous version is that all dispatchers
      will log the traceback (to avocado.debug) and that instead of individual
      arguments it supports *args.
      Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
      98d4c181