lasso/tests/integration
John Dennis 3d9d58d52c Make more Python scripts compatible with both Py2 and Py3
While porting other Python code in the repo to run under Py3 (as well
as Py2) it was discovered there were a number of other Python scripts
which also needed porting. However these scripts are never invoked
during a build so there was no easy way to test the porting work. I
assume these scripts are for developers only and/or are
historical. Because there was no way for me to test the porting
changes on these scripts I did not want to include the changes in the
patch for the Py3 porting which fixed scripts that are invoked during
the build (the former patch is mandatory, this patch is optional at
the moment). I did verify the scripts compile cleanly under both Py2
and Py3, however it's possible I missed porting something or the error
does not show up until run-time.

Examples of the required changes are:

* Replace use of the built-in function file() with open().  file()
  does not exist in Py3, open works in both Py2 and Py3.  The code was
  also modified to use a file context manager (e.g. with open(xxx) as
  f:). This assures open files are properly closed when the code block
  using the file goes out of scope. This is a standard modern Python
  idiom.

* Replace all use of the print keyword with the six.print_()
  function, which itself is an emulation of Py3's print function. Py3
  no longer has a print keyword, only a print() function.

* The dict methods .keys(), .values(), .items() no longer return a
  list in Py3, instead they return a "view" object which is an
  iterator whose result is an unordered set. The most notable
  consequence is you cannot index the result of these functions like
  your could in Py2 (e.g. dict.keys()[0] will raise a run time
  exception).

* Replace use of StringIO.StringIO and cStringIO with
  six.StringIO. Py3 no longer has cStringIO and the six variant
  handles the correct import.

* Py3 no longer allows the "except xxx, variable" syntax, where
  variable appering after the comma is assigned the exception object,
  you must use the "as" keyword to perform the variable assignment
  (e.g. execpt xxx as variable)

* Python PEP 3113 removed tuple parameter unpacking. Therefore you can
  no longer define a formal parameter list that contains tuple
  notation representing a single parameter that is unpacked into
  multiple arguments.

License: MIT
Signed-off-by: John Dennis <jdennis@redhat.com>
2018-07-24 11:03:09 +02:00
..
saml2 Make more Python scripts compatible with both Py2 and Py3 2018-07-24 11:03:09 +02:00
README Tests: add configuration file loading to integration test 2009-08-27 12:07:40 +00:00
private-key.pem added integration tests to repository 2008-02-25 09:55:36 +00:00
public-key.pem added integration tests to repository 2008-02-25 09:55:36 +00:00
valgrind-wrapper.sh [integration tests] does not use full leak report 2011-11-22 18:51:49 +01:00

README

README for Lasso Integration Tests
==================================

Requirements:
 - twill (apt-get install python-twill)
 - nose (apt-get install python-nose)
 - Authentic & LCS from Subversion and CVS



Default configuration is to look for apps in their installation directories,
but it is also possible to run tests without installing anything.  Example of a
config file is in tests/config.py.example (must be renamed to config.py to be
effective). You can also place a configuration file in
~/.config/lasso_integration.conf, the format is "key = value" without any
quoting.

Tests are run with nosetests from this directory.

You can use the following environement variables to fine tune the execution of
the tests:
        - LASSO_BUILDDIR, to specify an out of source build directory to
          test,
        - NO_SILENT, to allow authentic and lcs outputs,
        - VALGRIND, to check memory leaks using valgrind.