This adds a new test decorator: skip_unless_feature(). The argument is
the same as passed to features.check(). If the feature is not supported,
the test will be skipped.
This removes several kinds of boilerplate copied and pasted around tests
so test feature checking is handled and displayed more consistently.
Refs #4193
These modules are safe to import and this better follows PEP 8.
From https://www.python.org/dev/peps/pep-0008/#imports
> Imports are always put at the top of the file, just after any module
> comments and docstrings, and before module globals and constants.
In Python 3, cPickle and pickle have been merged to a single module.
From https://docs.python.org/3/whatsnew/3.0.html#library-changes
> A common pattern in Python 2.x is to have one version of a module
> implemented in pure Python, with an optional accelerated version
> implemented as a C extension; for example, pickle and cPickle. This
> places the burden of importing the accelerated version and falling
> back on the pure Python version on each user of these modules. In
> Python 3.0, the accelerated versions are considered implementation
> details of the pure Python versions. Users should always import the
> standard version, which attempts to import the accelerated version and
> falls back to the pure Python version. The pickle / cPickle pair
> received this treatment.
Can now move the 'import pickle' to the top of the test file.
Image data is expected to be read in bytes mode, not text mode so
ContainerIO should return bytes in all methods. The passed in file
handler is expected to be opened in bytes mode (as TarIO already does).
Appeared in the form:
ResourceWarning: unclosed file <_io.BufferedReader name='Tests/images/invalid-exif-without-x-resolution.jpg'>
Enable all warnings to always display during tests to help catch these
warnings earlier.
To better follow conventional pytest style, this removes the outer
wrapper class in favor of a function for some tests. These tests were
picked as they are relatively simple and presented no barriers to a
quick port. The assert* methods are replaced with assert statements.
When necessary, a fixture is used to create a temporary directory.
This commit does not convert the entire test suite to this style as some
test classes use methods or other advanced features that are difficult
to automatically convert. The goal is to address these issues in
followup commits.
Refs #4193