Repository: zhmcclient/python-zhmcclient

Issue:
Error "fixture 'capture' not found" on Py34+36 when migrating test_logging to pytest
### Actual behavior

When migrating the test_logging.py testcases from unittest to pytest, the following error happens on Python 3.4 and 3.6 (but not on 2.7):

```
$ PYTHONPATH=. py.test -s -x test_pt.py
. . .
file /media/share/Projects/zhmcclient/repos/python-zhmcclient/try/logcapture/test_pt.py, line 7
      @log_capture(level=logging.DEBUG)
      def test_2(self, capture):
E       fixture 'capture' not found
>       available fixtures: cache, capfd, capsys, cov, doctest_namespace, monkeypatch, pytestconfig, record_xml_property, recwarn, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.
```

The most simple source file reproducing this error, is:

```
import logging
import pytest  # not used here, but is actually used in the real life testcase
from testfixtures import log_capture

class Test2(object):

    @log_capture(level=logging.DEBUG)
    def test_2(self, capture):
        pass
```

Travis logs: https://travis-ci.org/zhmcclient/python-zhmcclient/builds/286095482
Appveyor logs: https://ci.appveyor.com/project/leopoldjuergen/python-zhmcclient/build/1.0.1145

As a comparison, the following unittest-based source file (with code that corresponds to the pytest-based file shown above) runs fine in all of these Python versions:

```
import logging
import unittest
from testfixtures import log_capture

class Test1(unittest.TestCase):

    @log_capture(level=logging.DEBUG)
    def test1(self, capture):
        pass
```

This has been reported to the testfixtures project as issue Simplistix/testfixtures#65.

### Expected behavior

Runs fine when using pytest, on all python versions.

### Execution environment

* zhmcclient version: Git branch of PR #456.
* Operating system (type+version): ubuntu 16.04
* HMC version: n/a
* CPC version: n/a


Discussion:
coveralls: 
[![Coverage Status](https://coveralls.io/builds/13651438/badge)](https://coveralls.io/builds/13651438)

Coverage decreased (-18.4%) to 69.271% when pulling **b4050fc28c6175a6b93873b1262cbc3c95b9ddeb on andy/migrate-to-pytest-part2** into **9a19f326a9a6740884247a397327ca26e4c35811 on master**.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/13657534/badge)](https://coveralls.io/builds/13657534)

Coverage decreased (-18.4%) to 69.271% when pulling **0d37be29cd898ab6360ba8d5e50493fca7d9cc35 on andy/migrate-to-pytest-part2** into **9a19f326a9a6740884247a397327ca26e4c35811 on master**.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/13666745/badge)](https://coveralls.io/builds/13666745)

Coverage increased (+0.1%) to 87.733% when pulling **b14a51f1c795c20aa9db1ffb77aab7469311f3fb on andy/migrate-to-pytest-part2** into **9a19f326a9a6740884247a397327ca26e4c35811 on master**.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/13666797/badge)](https://coveralls.io/builds/13666797)

Coverage increased (+0.1%) to 87.733% when pulling **b14a51f1c795c20aa9db1ffb77aab7469311f3fb on andy/migrate-to-pytest-part2** into **9a19f326a9a6740884247a397327ca26e4c35811 on master**.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/13666987/badge)](https://coveralls.io/builds/13666987)

Coverage increased (+0.1%) to 87.733% when pulling **30c1282b4a894a75004a80fc422044d6ad014ba0 on andy/migrate-to-pytest-part2** into **9a19f326a9a6740884247a397327ca26e4c35811 on master**.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/13701235/badge)](https://coveralls.io/builds/13701235)

Coverage increased (+0.1%) to 87.733% when pulling **41d26b5fcdf249386dd462580603f84447964e9d on andy/migrate-to-pytest-part2** into **5bb72418b2d42eae43b9c605bbad6034cf5aa8bf on master**.


Patch:
diff --git a/.travis.yml b/.travis.yml
index db14ec8..6ee16b1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -30,26 +30,41 @@ matrix:
       python: "3.4"
       env:
         - PACKAGE_LEVEL=minimum
-    - os: linux
-      language: python
-      python: "3.5"
-      env:
-        - PACKAGE_LEVEL=minimum
-      before_install:
-        - if [[ "$TRAVIS_EVENT_TYPE" != "cron" ]]; then exit 0; fi
+#    - os: linux
+#      language: python
+#      python: "3.4"
+#      env:
+#        - PACKAGE_LEVEL=latest
+#    - os: linux
+#      language: python
+#      python: "3.5"
+#      env:
+#        - PACKAGE_LEVEL=minimum
+#    - os: linux
+#      language: python
+#      python: "3.5"
+#      env:
+#        - PACKAGE_LEVEL=latest
+#    - os: linux
+#      language: python
+#      python: "3.6"
+#      env:
+#        - PACKAGE_LEVEL=minimum
     - os: linux
       language: python
       python: "3.6"
       env:
         - PACKAGE_LEVEL=latest
-    - os: linux
-      language: python
-      python: "pypy-5.3.1"  # Python 2.7.10
-      env:
-        - PACKAGE_LEVEL=minimum
-      before_install:
-        - if [[ "$TRAVIS_EVENT_TYPE" != "cron" ]]; then exit 0; fi
-# TODO: Re-enable osx support once Travis has better OS-X capacity
+#    - os: linux
+#      language: python
+#      python: "pypy-5.3.1"  # Python 2.7.10
+#      env:
+#        - PACKAGE_LEVEL=minimum
+#    - os: linux
+#      language: python
+#      python: "pypy-5.3.1"  # Python 2.7.10
+#      env:
+#        - PACKAGE_LEVEL=latest
 #    - os: osx
 #      language: generic
 #      python:
@@ -62,16 +77,12 @@ matrix:
 #      env:
 #        - PACKAGE_LEVEL=latest
 #        - PYTHON=2
-#      before_install:
-#        - if [[ "$TRAVIS_EVENT_TYPE" != "cron" ]]; then exit 0; fi
 #    - os: osx
 #      language: generic
 #      python:
 #      env:
 #        - PACKAGE_LEVEL=minimum
 #        - PYTHON=3
-#      before_install:
-#        - if [[ "$TRAVIS_EVENT_TYPE" != "cron" ]]; then exit 0; fi
 #    - os: osx
 #      language: generic
 #      python:
@@ -79,8 +90,20 @@ matrix:
 #        - PACKAGE_LEVEL=latest
 #        - PYTHON=3
 
+before_install:
+  - if [[ "$TRAVIS_BRANCH" == "manual-ci-run" ]]; then
+      export _NEED_REBASE=true;
+    fi
+  - if [[ -n $_NEED_REBASE ]]; then git fetch origin master; fi
+  - if [[ -n $_NEED_REBASE ]]; then git branch master FETCH_HEAD; fi
+  - if [[ -n $_NEED_REBASE ]]; then git rebase master; fi
+  - git branch -av
+
 # commands to install dependencies
 install:
+  - if [[ "$TRAVIS_BRANCH" == "manual-ci-run" || "$TRAVIS_PULL_REQUEST_BRANCH" == "manual-ci-run" ]]; then
+      export _MANUAL_CI_RUN=true;
+    fi
   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
       if [[ "${PYTHON:0:1}" == "2" ]]; then
         export PYTHON_CMD=python;
@@ -124,11 +147,10 @@ install:
 # commands to run builds & tests
 script:
   - make check
+  - if [[ -n $_MANUAL_CI_RUN ]]; then make pylint; fi
   - make test
-  - if [[ "$TRAVIS_EVENT_TYPE" == "cron" ]]; then
-      make build;
-      make builddoc;
-    fi
+  - if [[ -n $_MANUAL_CI_RUN ]]; then make build; fi
+  - if [[ -n $_MANUAL_CI_RUN ]]; then make builddoc; fi
 
 after_success:
   - if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PYTHON_VERSION" == "2.7" && "$PACKAGE_LEVEL" == "latest" ]]; then
diff --git a/Makefile b/Makefile
index a957987..8793b55 100644
--- a/Makefile
+++ b/Makefile
@@ -79,6 +79,13 @@ win64_dist_file := $(dist_dir)/$(package_name)-$(package_version).win-amd64.exe
 # dist_files := $(bdist_file) $(sdist_file) $(win64_dist_file)
 dist_files := $(bdist_file) $(sdist_file)
 
+# Source files in the packages
+package_py_files := \
+    $(wildcard $(package_name)/*.py) \
+    $(wildcard $(package_name)/*/*.py) \
+    $(wildcard zhmcclient_mock/*.py) \
+    $(wildcard zhmcclient_mock/*/*.py) \
+
 # Directory for generated API documentation
 doc_build_dir := build_doc
 
@@ -94,8 +101,19 @@ doc_dependent_files := \
     $(doc_conf_dir)/conf.py \
     $(wildcard $(doc_conf_dir)/*.rst) \
     $(wildcard $(doc_conf_dir)/notebooks/*.ipynb) \
-    $(wildcard $(package_name)/*.py) \
-    $(wildcard zhmcclient_mock/*.py) \
+    $(package_py_files) \
+
+# Directory with test source files
+test_dir := tests
+
+# Test log
+test_log_file := test_$(python_version_fn).log
+
+# Source files with test code
+test_py_files := \
+    $(wildcard $(test_dir)/*.py) \
+    $(wildcard $(test_dir)/*/*.py) \
+    $(wildcard $(test_dir)/*/*/*.py) \
 
 # Flake8 config file
 flake8_rc_file := setup.cfg
@@ -106,32 +124,32 @@ pylint_rc_file := .pylintrc
 # Source files for check (with PyLint and Flake8)
 check_py_files := \
     setup.py \
-    $(wildcard $(package_name)/*.py) \
-    $(wildcard zhmcclient_mock/*.py) \
-    $(wildcard tests/unit/*.py) \
-    $(wildcard tests/unit/zhmcclient_mock/*.py) \
-    $(wildcard tests/function/*.py) \
+    $(package_py_files) \
+    $(test_py_files) \
     $(wildcard docs/notebooks/*.py) \
     $(wildcard tools/cpcinfo) \
     $(wildcard tools/cpcdata) \
 
-# Test log
-test_log_file := test_$(python_version_fn).log
-
 ifdef TESTCASES
 pytest_opts := -k $(TESTCASES)
 else
 pytest_opts :=
 endif
 
+# Files to be built
+ifeq ($(PLATFORM),Windows)
+build_files := $(win64_dist_file)
+else
+build_files := $(bdist_file) $(sdist_file)
+endif
+
 # Files the distribution archive depends upon.
 dist_dependent_files := \
     setup.py setup.cfg \
     README.rst \
     requirements.txt \
     $(wildcard *.py) \
-    $(wildcard $(package_name)/*.py) \
-    $(wildcard zhmcclient_mock/*.py) \
+    $(package_py_files) \
 
 # No built-in rules needed:
 .SUFFIXES:
@@ -143,15 +161,17 @@ help:
 	@echo 'Uses the currently active Python environment: Python $(python_version_fn)'
 	@echo 'Valid targets are (they do just what is stated, i.e. no automatic prereq targets):'
 	@echo '  develop    - Prepare the development environment by installing prerequisites'
-	@echo '  build      - Build the distribution files in: $(dist_dir) (requires Linux or OSX)'
-	@echo '  buildwin   - Build the Windows installable in: $(dist_dir) (requires Windows 64-bit)'
-	@echo '  builddoc   - Build documentation in: $(doc_build_dir)'
+	@echo '  install    - Install package in active Python environment'
 	@echo '  check      - Run Flake8 on sources and save results in: flake8.log'
 	@echo '  pylint     - Run PyLint on sources and save results in: pylint.log'
-	@echo '  test       - Run unit tests (and test coverage) and save results in: $(test_log_file)'
+	@echo '  test       - Run tests (and test coverage) and save results in: $(test_log_file)'
+	@echo '               Does not include install but depends on it, so make sure install is current.'
 	@echo '               Env.var TESTCASES can be used to specify a py.test expression for its -k option'
-	@echo '  all        - Do all of the above (except buildwin when not on Windows)'
-	@echo '  install    - Install package in active Python environment and test import (includes build)'
+	@echo '  build      - Build the distribution files in: $(dist_dir)'
+	@echo '               On Windows, builds: $(win64_dist_file)'
+	@echo '               On Linux + OSX, builds: $(bdist_file) $(sdist_file)'
+	@echo '  builddoc   - Build documentation in: $(doc_build_dir)'
+	@echo '  all        - Do all of the above'
 	@echo '  uninstall  - Uninstall package from active Python environment'
 	@echo '  upload     - Upload the distribution files to PyPI (includes uninstall+build)'
 	@echo '  clean      - Remove any temporary files'
@@ -170,13 +190,13 @@ _pip:
 	$(PIP_CMD) install $(pip_level_opts) pip setuptools wheel pbr
 
 .PHONY: develop
-develop: _pip
+develop: _pip dev-requirements.txt requirements.txt
 	@echo 'Installing runtime and development requirements with PACKAGE_LEVEL=$(PACKAGE_LEVEL)'
 	$(PIP_CMD) install $(pip_level_opts) -r dev-requirements.txt
 	@echo '$@ done.'
 
 .PHONY: build
-build: $(bdist_file) $(sdist_file)
+build: $(build_files)
 	@echo '$@ done.'
 
 .PHONY: buildwin
@@ -249,9 +269,9 @@ pylint: pylint.log
 	@echo '$@ done.'
 
 .PHONY: install
-install: _pip
+install: _pip requirements.txt setup.py setup.cfg $(package_py_files)
 	@echo 'Installing runtime requirements with PACKAGE_LEVEL=$(PACKAGE_LEVEL)'
-	$(PIP_CMD) install $(pip_level_opts) .
+	$(PIP_CMD) install $(pip_level_opts) -r requirements.txt .
 	$(PYTHON_CMD) -c "import zhmcclient; print('Import: ok')"
 	@echo 'Done: Installed $(package_name) into current Python environment.'
 	@echo '$@ done.'
@@ -268,12 +288,10 @@ test: $(test_log_file)
 .PHONY: clobber
 clobber: uninstall clean
 	rm -Rf $(doc_build_dir) htmlcov .tox
-	rm -fv pylint.log flake8.log test_*.log
-	rm -fv $(bdist_file) $(sdist_file) $(win64_dist_file)
+	rm -f pylint.log flake8.log test_*.log $(bdist_file) $(sdist_file) $(win64_dist_file)
 	@echo 'Done: Removed all build products to get to a fresh state.'
 	@echo '$@ done.'
 
-# Also remove any build products that are dependent on the Python version
 .PHONY: clean
 clean:
 	rm -Rf build .cache $(package_name).egg-info .eggs
@@ -283,7 +301,7 @@ clean:
 	@echo '$@ done.'
 
 .PHONY: all
-all: develop check build builddoc test
+all: develop install check pylint test build builddoc
 	@echo '$@ done.'
 
 .PHONY: upload
@@ -303,7 +321,7 @@ endif
 # Distribution archives.
 $(bdist_file): Makefile $(dist_dependent_files)
 ifneq ($(PLATFORM),Windows)
-	rm -Rfv $(package_name).egg-info .eggs
+	rm -Rfv $(package_name).egg-info .eggs build
 	$(PYTHON_CMD) setup.py bdist_wheel -d $(dist_dir) --universal
 	@echo 'Done: Created binary distribution archive: $@'
 else
@@ -313,7 +331,7 @@ endif
 
 $(sdist_file): Makefile $(dist_dependent_files)
 ifneq ($(PLATFORM),Windows)
-	rm -Rfv $(package_name).egg-info .eggs
+	rm -Rfv $(package_name).egg-info .eggs build
 	$(PYTHON_CMD) setup.py sdist -d $(dist_dir)
 	@echo 'Done: Created source distribution archive: $@'
 else
@@ -323,7 +341,7 @@ endif
 
 $(win64_dist_file): Makefile $(dist_dependent_files)
 ifeq ($(PLATFORM),Windows)
-	rm -Rfv $(package_name).egg-info .eggs
+	rm -Rfv $(package_name).egg-info .eggs build
 	$(PYTHON_CMD) setup.py bdist_wininst -d $(dist_dir) -o -t "$(package_name) v$(package_version)"
 	@echo 'Done: Created Windows installable: $@'
 else
@@ -342,15 +360,14 @@ else
 	@echo 'Info: PyLint requires Python 2; skipping this step on Python $(python_major_version)'
 endif
 
-# TODO: Once Flake8 has no more errors, remove the dash "-"
 flake8.log: Makefile $(flake8_rc_file) $(check_py_files)
 	rm -fv $@
 	bash -c 'set -o pipefail; flake8 $(check_py_files) 2>&1 |tee $@.tmp'
 	mv -f $@.tmp $@
 	@echo 'Done: Created Flake8 log file: $@'
 
-$(test_log_file): Makefile $(package_name)/*.py zhmcclient_mock/*.py tests/unit/*.py tests/unit/zhmcclient_mock/*.py tests/function/*.py .coveragerc
+$(test_log_file): Makefile $(package__py_files) $(test_py_files) .coveragerc
 	rm -fv $@
-	bash -c 'set -o pipefail; PYTHONWARNINGS=default py.test -s tests --cov $(package_name) --cov zhmcclient_mock --cov-config .coveragerc --cov-report=html $(pytest_opts) 2>&1 |tee $@.tmp'
+	bash -c 'set -o pipefail; PYTHONWARNINGS=default py.test -s $(test_dir) --cov $(package_name) --cov zhmcclient_mock --cov-config .coveragerc --cov-report=html $(pytest_opts) 2>&1 |tee $@.tmp'
 	mv -f $@.tmp $@
 	@echo 'Done: Created test log file: $@'
diff --git a/appveyor.yml b/appveyor.yml
index 92d8340..c4b18dd 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -6,12 +6,12 @@ environment:
     - PYTHON_VERSION: 2.7
       PYTHON_ARCH: 32
       PYTHON_HOME: C:\Python27
-    - PYTHON_VERSION: 2.7
-      PYTHON_ARCH: 64
-      PYTHON_HOME: C:\Python27-x64
-    - PYTHON_VERSION: 3.4
-      PYTHON_ARCH: 32
-      PYTHON_HOME: C:\Python34
+#    - PYTHON_VERSION: 2.7
+#      PYTHON_ARCH: 64
+#      PYTHON_HOME: C:\Python27-x64
+#    - PYTHON_VERSION: 3.4
+#      PYTHON_ARCH: 32
+#      PYTHON_HOME: C:\Python34
 #    - PYTHON_VERSION: 3.4
 #      PYTHON_ARCH: 64
 #      PYTHON_HOME: C:\Python34-x64
@@ -35,6 +35,16 @@ configuration:
 
 install:
 
+  - if %APPVEYOR_REPO_BRANCH%.==manual-ci-run. set _NEED_REBASE=true
+  - if %_NEED_REBASE%.==true. git fetch origin master
+  - if %_NEED_REBASE%.==true. git branch master FETCH_HEAD
+  - if %_NEED_REBASE%.==true. git rebase master
+  - git branch -av
+
+  # TODO: Use the _MANUAL_CI_RUN variable in tox.ini to run certain parts only when set
+  - if %APPVEYOR_REPO_BRANCH%.==manual-ci-run. set _MANUAL_CI_RUN=true
+  - if %APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH%.==manual-ci-run. set _MANUAL_CI_RUN=true
+
   # Set PACKAGE_LEVEL for make
   - set PACKAGE_LEVEL=%configuration%
 
diff --git a/docs/changes.rst b/docs/changes.rst
index 8366dca..8c1d908 100644
--- a/docs/changes.rst
+++ b/docs/changes.rst
@@ -19,13 +19,45 @@ Change log
 ----------
 
 
-Version 0.18.0
+Version 0.19.0
 ^^^^^^^^^^^^^^
 
 Released: not yet
 
 **Incompatible changes:**
 
+**Deprecations:**
+
+**Bug fixes:**
+
+* Fixed a flawed setup of setuptools in Python 2.7 on the Travis CI, where
+  the metadata directory of setuptools existed twice, by adding a script
+  `remove_duplicate_setuptools.py` that removes the moot copy of the metadata
+  directory (issue #434).
+
+* Fixed a bug where multiple Session objects shared the same set of
+  HTTP header fields, causing confusion in the logon status.
+
+**Enhancements:**
+
+* Migrated all remaining test cases from unittest to pytest, and started
+  improving the testcases using pytest specific features such as
+  parametrization.
+
+**Known issues:**
+
+* See `list of open issues`_.
+
+.. _`list of open issues`: https://github.com/zhmcclient/python-zhmcclient/issues
+
+
+Version 0.18.0
+^^^^^^^^^^^^^^
+
+Released: 2017-10-19
+
+**Incompatible changes:**
+
 * Removed the zhmc CLI support from this project, moving it into a new GitHub
   project ``zhmcclient/zhmccli``.
 
@@ -40,8 +72,6 @@ Released: not yet
     - python-utils  (from progressbar2)
     - wcwidth  (from prompt-toolkit -> click-repl)
 
-**Deprecations:**
-
 **Bug fixes:**
 
 * Fixed a flawed setup of setuptools in Python 2.7 on the Travis CI, where
@@ -49,14 +79,6 @@ Released: not yet
   `remove_duplicate_setuptools.py` that removes the moot copy of the metadata
   directory (issue #434).
 
-**Enhancements:**
-
-**Known issues:**
-
-* See `list of open issues`_.
-
-  .. _`list of open issues`: https://github.com/zhmcclient/python-zhmcclient/issues
-
 
 Version 0.17.0
 ^^^^^^^^^^^^^^
diff --git a/zhmcclient/_session.py b/zhmcclient/_session.py
index 0b4c95e..937c238 100644
--- a/zhmcclient/_session.py
+++ b/zhmcclient/_session.py
@@ -23,6 +23,7 @@ import time
 import re
 import collections
 import six
+from copy import copy
 try:
     from collections import OrderedDict
 except ImportError:
@@ -340,7 +341,7 @@ class Session(object):
             scheme=_HMC_SCHEME,
             host=self._host,
             port=_HMC_PORT)
-        self._headers = _STD_HEADERS  # dict with standard HTTP headers
+        self._headers = copy(_STD_HEADERS)  # dict with standard HTTP headers
         if session_id is not None:
             # Create a logged-on state (same state as in _do_logon())
             self._session_id = session_id


Test patch:
diff --git a/tests/unit/common/test_utils.py b/tests/unit/common/test_utils.py
index 1967f8f..692af7e 100644
--- a/tests/unit/common/test_utils.py
+++ b/tests/unit/common/test_utils.py
@@ -128,7 +128,7 @@ class TestUtilsAssertResources(object):
             exp_resources[0].properties['description'] = 'changed description'
 
         # Execute the code to be tested
-        with pytest.raises(AssertionError) as exc_info:
+        with pytest.raises(AssertionError):
             assert_resources(resources, exp_resources, prop_names)
 
     @pytest.mark.parametrize(
@@ -148,5 +148,5 @@ class TestUtilsAssertResources(object):
         prop_names = exp_resources[0].properties.keys()
 
         # Execute the code to be tested
-        with pytest.raises(AssertionError) as exc_info:
+        with pytest.raises(AssertionError):
             assert_resources(resources, exp_resources, prop_names)
diff --git a/tests/unit/test_client.py b/tests/unit/test_client.py
old mode 100755
new mode 100644
index eedd9d5..29d4626
--- a/tests/unit/test_client.py
+++ b/tests/unit/test_client.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # Copyright 2016-2017 IBM Corp. All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/tests/unit/test_exceptions.py b/tests/unit/test_exceptions.py
old mode 100755
new mode 100644
index c620b6a..dbc13af
--- a/tests/unit/test_exceptions.py
+++ b/tests/unit/test_exceptions.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # Copyright 2016-2017 IBM Corp. All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/tests/unit/test_hba.py b/tests/unit/test_hba.py
old mode 100755
new mode 100644
index 94878c6..a51654d
--- a/tests/unit/test_hba.py
+++ b/tests/unit/test_hba.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # Copyright 2016-2017 IBM Corp. All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/tests/unit/test_logging.py b/tests/unit/test_logging.py
old mode 100755
new mode 100644
index 33bd7e5..2c93d54
--- a/tests/unit/test_logging.py
+++ b/tests/unit/test_logging.py
@@ -19,8 +19,8 @@ Unit tests for _logging module.
 from __future__ import absolute_import, print_function
 
 import logging
-import unittest
-from testfixtures import log_capture
+import pytest
+from testfixtures import LogCapture
 
 from zhmcclient._logging import logged_api_call, get_logger
 
@@ -126,32 +126,42 @@ _EXP_LOG_MSG_ENTER = "==> %s, args: %.500r, kwargs: %.500r"
 _EXP_LOG_MSG_LEAVE = "<== %s, result: %.1000r"
 
 
+@pytest.fixture()
+def capture():
+    """
+    This way of defining a fixture works around the issue that when
+    using the decorator testfixtures.log_capture() instead, pytest
+    fails with "fixture 'capture' not found".
+    """
+    with LogCapture(level=logging.DEBUG) as log:
+        yield log
+
+
 #
 # Test cases
 #
 
-class TestLoggingDecorator(unittest.TestCase):
+class TestLoggingDecorator(object):
     """All test cases for the @logged_api_call decorator."""
 
     def assert_log_capture(self, log_capture, exp_apifunc):
 
-        self.assertEqual(len(log_capture.records), 2)
+        assert len(log_capture.records) == 2
 
         enter_record = log_capture.records[0]
-        self.assertEqual(enter_record.name, _EXP_LOGGER_NAME)
-        self.assertEqual(enter_record.levelname, _EXP_LOG_LEVEL)
-        self.assertEqual(enter_record.msg, _EXP_LOG_MSG_ENTER)
-        self.assertEqual(enter_record.args[0], exp_apifunc)
+        assert enter_record.name == _EXP_LOGGER_NAME
+        assert enter_record.levelname == _EXP_LOG_LEVEL
+        assert enter_record.msg == _EXP_LOG_MSG_ENTER
+        assert enter_record.args[0] == exp_apifunc
         # We don't check the positional args and keyword args
 
         leave_record = log_capture.records[1]
-        self.assertEqual(leave_record.name, _EXP_LOGGER_NAME)
-        self.assertEqual(leave_record.levelname, _EXP_LOG_LEVEL)
-        self.assertEqual(leave_record.msg, _EXP_LOG_MSG_LEAVE)
-        self.assertEqual(leave_record.args[0], exp_apifunc)
+        assert leave_record.name == _EXP_LOGGER_NAME
+        assert leave_record.levelname == _EXP_LOG_LEVEL
+        assert leave_record.msg == _EXP_LOG_MSG_LEAVE
+        assert leave_record.args[0] == exp_apifunc
         # We don't check the positional args and keyword args
 
-    @log_capture(level=logging.DEBUG)
     def test_1a_global_from_global(self, capture):
         """Simple test calling a decorated global function from a global
         function."""
@@ -160,7 +170,6 @@ class TestLoggingDecorator(unittest.TestCase):
 
         self.assert_log_capture(capture, 'decorated_global_function()')
 
-    @log_capture(level=logging.DEBUG)
     def test_1b_global_from_method(self, capture):
         """Simple test calling a decorated global function from a method."""
 
@@ -168,7 +177,6 @@ class TestLoggingDecorator(unittest.TestCase):
 
         self.assert_log_capture(capture, 'decorated_global_function()')
 
-    @log_capture(level=logging.DEBUG)
     def test_2a_global_inner1_from_global(self, capture):
         """Simple test calling a decorated inner function defined in a global
         function from a global function."""
@@ -180,7 +188,6 @@ class TestLoggingDecorator(unittest.TestCase):
         self.assert_log_capture(capture,
                                 'global1_function.decorated_inner1_function()')
 
-    @log_capture(level=logging.DEBUG)
     def test_2b_global_inner1_from_method(self, capture):
         """Simple test calling a decorated inner function defined in a global
         function from a method."""
@@ -192,7 +199,6 @@ class TestLoggingDecorator(unittest.TestCase):
         self.assert_log_capture(capture,
                                 'global1_function.decorated_inner1_function()')
 
-    @log_capture(level=logging.DEBUG)
     def test_3a_global_inner2_from_global(self, capture):
         """Simple test calling a decorated inner function defined in an inner
         function defined in a global function from a global function."""
@@ -204,7 +210,6 @@ class TestLoggingDecorator(unittest.TestCase):
         self.assert_log_capture(capture,
                                 'inner1_function.decorated_inner2_function()')
 
-    @log_capture(level=logging.DEBUG)
     def test_3b_global_inner1_from_method(self, capture):
         """Simple test calling a decorated inner function defined in an inner
         function defined in a global function from a method."""
@@ -216,7 +221,6 @@ class TestLoggingDecorator(unittest.TestCase):
         self.assert_log_capture(capture,
                                 'inner1_function.decorated_inner2_function()')
 
-    @log_capture(level=logging.DEBUG)
     def test_4a_method_from_global(self, capture):
         """Simple test calling a decorated method from a global function."""
 
@@ -227,7 +231,6 @@ class TestLoggingDecorator(unittest.TestCase):
 
         self.assert_log_capture(capture, 'Decorator1Class.decorated_method()')
 
-    @log_capture(level=logging.DEBUG)
     def test_4b_method_from_method(self, capture):
         """Simple test calling a decorated method from a method."""
 
@@ -238,7 +241,6 @@ class TestLoggingDecorator(unittest.TestCase):
 
         self.assert_log_capture(capture, 'Decorator1Class.decorated_method()')
 
-    @log_capture(level=logging.DEBUG)
     def test_5a_method_from_global(self, capture):
         """Simple test calling a decorated inner function defined in a method
         from a global function."""
@@ -251,7 +253,6 @@ class TestLoggingDecorator(unittest.TestCase):
         self.assert_log_capture(capture,
                                 'method.decorated_inner_function()')
 
-    @log_capture(level=logging.DEBUG)
     def test_5b_method_from_method(self, capture):
         """Simple test calling a decorated inner function defined in a method
         from a method."""
@@ -267,7 +268,7 @@ class TestLoggingDecorator(unittest.TestCase):
     def test_decorated_class(self):
         """Test that using the decorator on a class raises TypeError."""
 
-        with self.assertRaises(TypeError):
+        with pytest.raises(TypeError):
 
             @logged_api_call
             class DecoratedClass(object):
@@ -276,7 +277,7 @@ class TestLoggingDecorator(unittest.TestCase):
     def test_decorated_property(self):
         """Test that using the decorator on a property raises TypeError."""
 
-        with self.assertRaises(TypeError):
+        with pytest.raises(TypeError):
 
             class Class(object):
 
@@ -286,7 +287,7 @@ class TestLoggingDecorator(unittest.TestCase):
                     return self
 
 
-class TestGetLogger(unittest.TestCase):
+class TestGetLogger(object):
     """All test cases for get_logger()."""
 
     def test_root_logger(self):
@@ -296,11 +297,10 @@ class TestGetLogger(unittest.TestCase):
 
         zhmc_logger = get_logger('')
 
-        self.assertTrue(isinstance(zhmc_logger, logging.Logger))
-        self.assertEqual(zhmc_logger, py_logger)
-        self.assertTrue(len(zhmc_logger.handlers) >= 1,
-                        "Unexpected list of logging handlers: %r" %
-                        zhmc_logger.handlers)
+        assert isinstance(zhmc_logger, logging.Logger)
+        assert zhmc_logger == py_logger
+        assert len(zhmc_logger.handlers) >= 1, \
+            "Unexpected list of logging handlers: %r" % zhmc_logger.handlers
 
     def test_foo_logger(self):
         """Test that get_logger('foo') returns the Python logger 'foo'
@@ -309,8 +309,7 @@ class TestGetLogger(unittest.TestCase):
 
         zhmc_logger = get_logger('foo')
 
-        self.assertTrue(isinstance(zhmc_logger, logging.Logger))
-        self.assertEqual(zhmc_logger, py_logger)
-        self.assertTrue(len(zhmc_logger.handlers) >= 1,
-                        "Unexpected list of logging handlers: %r" %
-                        zhmc_logger.handlers)
+        assert isinstance(zhmc_logger, logging.Logger)
+        assert zhmc_logger == py_logger
+        assert len(zhmc_logger.handlers) >= 1, \
+            "Unexpected list of logging handlers: %r" % zhmc_logger.handlers
diff --git a/tests/unit/test_lpar.py b/tests/unit/test_lpar.py
old mode 100755
new mode 100644
index 46a743d..5883b79
--- a/tests/unit/test_lpar.py
+++ b/tests/unit/test_lpar.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # Copyright 2016-2017 IBM Corp. All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,16 +18,16 @@ Unit tests for _lpar module.
 
 from __future__ import absolute_import, print_function
 
-import unittest
+# FIXME: Migrate requests_mock to zhmcclient_mock.
 import requests_mock
 
 from zhmcclient import Session, Client
 
 
-class LparTests(unittest.TestCase):
+class TestLpar(object):
     """All tests for Lpar and LparManager classes."""
 
-    def setUp(self):
+    def setup_method(self):
         self.session = Session('fake-host', 'fake-user', 'fake-id')
         self.client = Client(self.session)
         with requests_mock.mock() as m:
@@ -52,7 +51,7 @@ class LparTests(unittest.TestCase):
             cpcs = self.cpc_mgr.list(full_properties=False)
             self.cpc = cpcs[0]
 
-    def tearDown(self):
+    def teardown_method(self):
         with requests_mock.mock() as m:
             m.delete('/api/sessions/this-session', status_code=204)
             self.session.logoff()
@@ -60,7 +59,7 @@ class LparTests(unittest.TestCase):
     def test_init(self):
         """Test __init__() on LparManager instance in CPC."""
         lpar_mgr = self.cpc.lpars
-        self.assertEqual(lpar_mgr.cpc, self.cpc)
+        assert lpar_mgr.cpc == self.cpc
 
     def test_list_short_ok(self):
         """
@@ -87,16 +86,13 @@ class LparTests(unittest.TestCase):
 
             lpars = lpar_mgr.list(full_properties=False)
 
-            self.assertEqual(len(lpars), len(result['logical-partitions']))
+            assert len(lpars) == len(result['logical-partitions'])
             for idx, lpar in enumerate(lpars):
-                self.assertEqual(
-                    lpar.properties,
-                    result['logical-partitions'][idx])
-                self.assertEqual(
-                    lpar.uri,
-                    result['logical-partitions'][idx]['object-uri'])
-                self.assertFalse(lpar.full_properties)
-                self.assertEqual(lpar.manager, lpar_mgr)
+                assert lpar.properties == result['logical-partitions'][idx]
+                assert lpar.uri == \
+                    result['logical-partitions'][idx]['object-uri']
+                assert not lpar.full_properties
+                assert lpar.manager == lpar_mgr
 
     def test_list_full_ok(self):
         """
@@ -143,15 +139,14 @@ class LparTests(unittest.TestCase):
 
             lpars = lpar_mgr.list(full_properties=True)
 
-            self.assertEqual(len(lpars), len(result['logical-partitions']))
+            assert len(lpars) == len(result['logical-partitions'])
             for idx, lpar in enumerate(lpars):
-                self.assertEqual(lpar.properties['name'],
-                                 result['logical-partitions'][idx]['name'])
-                self.assertEqual(
-                    lpar.uri,
-                    result['logical-partitions'][idx]['object-uri'])
-                self.assertTrue(lpar.full_properties)
-                self.assertEqual(lpar.manager, lpar_mgr)
+                assert lpar.properties['name'] == \
+                    result['logical-partitions'][idx]['name']
+                assert lpar.uri == \
+                    result['logical-partitions'][idx]['object-uri']
+                assert lpar.full_properties
+                assert lpar.manager == lpar_mgr
 
     def test_activate(self):
         """
@@ -185,7 +180,7 @@ class LparTests(unittest.TestCase):
             m.post("/api/logical-partitions/fake-lpar-id-1/operations/"
                    "activate", json=result)
             status = lpar.activate(wait_for_completion=False)
-            self.assertEqual(status, result)
+            assert status == result
 
     def test_deactivate(self):
         """
@@ -219,7 +214,7 @@ class LparTests(unittest.TestCase):
             m.post("/api/logical-partitions/fake-lpar-id-1/operations/"
                    "deactivate", json=result)
             status = lpar.deactivate(wait_for_completion=False)
-            self.assertEqual(status, result)
+            assert status == result
 
     def test_load(self):
         """
@@ -254,8 +249,4 @@ class LparTests(unittest.TestCase):
             m.post("/api/logical-partitions/fake-lpar-id-1/operations/load",
                    json=result)
             status = lpar.load(load_address='5162', wait_for_completion=False)
-            self.assertEqual(status, result)
-
-
-if __name__ == '__main__':
-    unittest.main()
+            assert status == result
diff --git a/tests/unit/test_manager.py b/tests/unit/test_manager.py
old mode 100755
new mode 100644
index 41b0e02..eb5febf
--- a/tests/unit/test_manager.py
+++ b/tests/unit/test_manager.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # Copyright 2016-2017 IBM Corp. All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,10 +18,11 @@ Unit tests for _manager module.
 
 from __future__ import absolute_import, print_function
 
-import unittest
 from datetime import datetime
 import time
+import re
 import warnings
+import pytest
 
 from zhmcclient import BaseResource, BaseManager, Session, NotFound, \
     NoUniqueMatch
@@ -76,12 +76,12 @@ class MyManager(BaseManager):
         return result_list
 
 
-class Manager1Tests(unittest.TestCase):
+class TestManager1(object):
     """
     Tests for the BaseManager class with one resource.
     """
 
-    def setUp(self):
+    def setup_method(self):
         self.session = Session(host='fake-host', userid='fake-user',
                                password='fake-pw')
         self.manager = MyManager(self.session)
@@ -103,18 +103,17 @@ class Manager1Tests(unittest.TestCase):
 
         repr_str = repr_str.replace('\n', '\\n')
         # We check just the begin of the string:
-        self.assertRegexpMatches(
-            repr_str,
-            r'^{classname}\s+at\s+0x{id:08x}\s+\(\\n.*'.format(
-                classname=manager.__class__.__name__,
-                id=id(manager)))
+        assert re.match(r'^{classname}\s+at\s+0x{id:08x}\s+\(\\n.*'.
+                        format(classname=manager.__class__.__name__,
+                               id=id(manager)),
+                        repr_str)
 
     def test_init_properties(self):
         """Test BaseManager properties after initialization."""
 
-        self.assertEqual(self.manager.resource_class, MyResource)
-        self.assertEqual(self.manager.session, self.session)
-        self.assertEqual(self.manager.parent, None)
+        assert self.manager.resource_class == MyResource
+        assert self.manager.session == self.session
+        assert self.manager.parent is None
 
     def test_invalidate_cache(self):
         """Test invalidate_cache()."""
@@ -122,11 +121,11 @@ class Manager1Tests(unittest.TestCase):
 
         # Populate the cache by finding a resource by name.
         self.manager.find(**filter_args)
-        self.assertEqual(self.manager._list_called, 1)
+        assert self.manager._list_called == 1
 
         # Check that on the second find by name, list() is not called again.
         self.manager.find(**filter_args)
-        self.assertEqual(self.manager._list_called, 1)
+        assert self.manager._list_called == 1
 
         # Invalidate the cache via invalidate_cache().
         self.manager.invalidate_cache()
@@ -134,7 +133,7 @@ class Manager1Tests(unittest.TestCase):
         # Check that on the third find by name, list() is called again, because
         # the cache had been invalidated.
         self.manager.find(**filter_args)
-        self.assertEqual(self.manager._list_called, 2)
+        assert self.manager._list_called == 2
 
     def test_flush(self):
         """Test flush() and verify that it raises a DeprecationWarning."""
@@ -142,25 +141,25 @@ class Manager1Tests(unittest.TestCase):
 
         # Populate the cache by finding a resource by name.
         self.manager.find(**filter_args)
-        self.assertEqual(self.manager._list_called, 1)
+        assert self.manager._list_called == 1
 
         # Check that on the second find by name, list() is not called again.
         self.manager.find(**filter_args)
-        self.assertEqual(self.manager._list_called, 1)
+        assert self.manager._list_called == 1
 
         # Invalidate the cache via flush().
         with warnings.catch_warnings(record=True) as wngs:
             warnings.simplefilter("always")
             self.manager.flush()
-        self.assertEqual(len(wngs), 1)
+        assert len(wngs) == 1
         wng = wngs[0]
-        self.assertTrue(issubclass(wng.category, DeprecationWarning),
-                        "Unexpected warnings class: %s" % wng.category)
+        assert issubclass(wng.category, DeprecationWarning), \
+            "Unexpected warnings class: %s" % wng.category
 
         # Check that on the third find by name, list() is called again, because
         # the cache had been invalidated.
         self.manager.find(**filter_args)
-        self.assertEqual(self.manager._list_called, 2)
+        assert self.manager._list_called == 2
 
     def test_list_not_implemented(self):
         """Test that BaseManager.list() raises NotImplementedError."""
@@ -175,16 +174,16 @@ class Manager1Tests(unittest.TestCase):
             name_prop='fake_name_prop',
             query_props=[])
 
-        with self.assertRaises(NotImplementedError):
+        with pytest.raises(NotImplementedError):
             manager.list()
 
 
-class Manager2Tests(unittest.TestCase):
+class TestManager2(object):
     """
     Tests for the BaseManager class with two resources.
     """
 
-    def setUp(self):
+    def setup_method(self):
         self.session = Session(host='fake-host', userid='fake-user',
                                password='fake-pw')
         self.manager = MyManager(self.session)
@@ -217,7 +216,7 @@ class Manager2Tests(unittest.TestCase):
 
         resources = self.manager.findall(**filter_args)
 
-        self.assertEqual(len(resources), 0)
+        assert len(resources) == 0
 
     def test_findall_name_one(self):
         """Test BaseManager.findall() with one resource matching by the name
@@ -226,9 +225,9 @@ class Manager2Tests(unittest.TestCase):
 
         resources = self.manager.findall(**filter_args)
 
-        self.assertEqual(len(resources), 1)
-        self.assertEqual(resources[0].uri, self.resource2.uri)
-        self.assertEqual(resources[0].name, self.resource2.name)
+        assert len(resources) == 1
+        assert resources[0].uri == self.resource2.uri
+        assert resources[0].name == self.resource2.name
 
     def test_findall_str_none(self):
         """Test BaseManager.findall() with no resource matching by a
@@ -236,7 +235,7 @@ class Manager2Tests(unittest.TestCase):
 
         resources = self.manager.findall(other="not-exists")
 
-        self.assertEqual(len(resources), 0)
+        assert len(resources) == 0
 
     def test_findall_str_one(self):
         """Test BaseManager.findall() with one resource matching by a
@@ -244,9 +243,9 @@ class Manager2Tests(unittest.TestCase):
 
         resources = self.manager.findall(other="fake-other-2")
 
-        self.assertEqual(len(resources), 1)
-        self.assertEqual(resources[0].uri, self.resource2.uri)
-        self.assertEqual(resources[0].name, self.resource2.name)
+        assert len(resources) == 1
+        assert resources[0].uri == self.resource2.uri
+        assert resources[0].name == self.resource2.name
 
     def test_findall_str_one_and(self):
         """Test BaseManager.findall() with one resource matching by two
@@ -255,9 +254,9 @@ class Manager2Tests(unittest.TestCase):
         resources = self.manager.findall(same="fake-same",
                                          other="fake-other-2")
 
-        self.assertEqual(len(resources), 1)
-        self.assertEqual(resources[0].uri, self.resource2.uri)
-        self.assertEqual(resources[0].name, self.resource2.name)
+        assert len(resources) == 1
+        assert resources[0].uri == self.resource2.uri
+        assert resources[0].name == self.resource2.name
 
     def test_findall_str_two(self):
         """Test BaseManager.findall() with two resources matching by a
@@ -265,9 +264,9 @@ class Manager2Tests(unittest.TestCase):
 
         resources = self.manager.findall(same="fake-same")
 
-        self.assertEqual(len(resources), 2)
-        self.assertEqual(set([res.uri for res in resources]),
-                         set([self.resource1.uri, self.resource2.uri]))
+        assert len(resources) == 2
+        assert set([res.uri for res in resources]) == \
+            set([self.resource1.uri, self.resource2.uri])
 
     def test_findall_str_two_or(self):
         """Test BaseManager.findall() with two resources matching by a
@@ -277,9 +276,9 @@ class Manager2Tests(unittest.TestCase):
         resources = self.manager.findall(other=["fake-other-1",
                                                 "fake-other-2"])
 
-        self.assertEqual(len(resources), 2)
-        self.assertEqual(set([res.uri for res in resources]),
-                         set([self.resource1.uri, self.resource2.uri]))
+        assert len(resources) == 2
+        assert set([res.uri for res in resources]) == \
+            set([self.resource1.uri, self.resource2.uri])
 
     def test_findall_int_none(self):
         """Test BaseManager.findall() with no resource matching by a
@@ -287,7 +286,7 @@ class Manager2Tests(unittest.TestCase):
 
         resources = self.manager.findall(int_other=815)
 
-        self.assertEqual(len(resources), 0)
+        assert len(resources) == 0
 
     def test_findall_int_one(self):
         """Test BaseManager.findall() with one resource matching by a
@@ -295,9 +294,9 @@ class Manager2Tests(unittest.TestCase):
 
         resources = self.manager.findall(int_other=24)
 
-        self.assertEqual(len(resources), 1)
-        self.assertEqual(resources[0].uri, self.resource2.uri)
-        self.assertEqual(resources[0].name, self.resource2.name)
+        assert len(resources) == 1
+        assert resources[0].uri == self.resource2.uri
+        assert resources[0].name == self.resource2.name
 
     def test_findall_int_two(self):
         """Test BaseManager.findall() with two resources matching by a
@@ -305,16 +304,16 @@ class Manager2Tests(unittest.TestCase):
 
         resources = self.manager.findall(int_same=42)
 
-        self.assertEqual(len(resources), 2)
-        self.assertEqual(set([res.uri for res in resources]),
-                         set([self.resource1.uri, self.resource2.uri]))
+        assert len(resources) == 2
+        assert set([res.uri for res in resources]) == \
+            set([self.resource1.uri, self.resource2.uri])
 
     def test_find_name_none(self):
         """Test BaseManager.find() with no resource matching by the name
         resource property."""
         filter_args = {self.manager._name_prop: "not-exists"}
 
-        with self.assertRaises(NotFound):
+        with pytest.raises(NotFound):
             self.manager.find(**filter_args)
 
     def test_find_name_one(self):
@@ -324,13 +323,13 @@ class Manager2Tests(unittest.TestCase):
 
         resource = self.manager.find(**filter_args)
 
-        self.assertEqual(resource.uri, self.resource2.uri)
-        self.assertEqual(resource.name, self.resource2.name)
+        assert resource.uri == self.resource2.uri
+        assert resource.name == self.resource2.name
 
     def test_find_str_none(self):
         """Test BaseManager.find() with no resource matching by a
         string-typed (non-name) resource property."""
-        with self.assertRaises(NotFound):
+        with pytest.raises(NotFound):
 
             self.manager.find(other="not-exists")
 
@@ -340,20 +339,20 @@ class Manager2Tests(unittest.TestCase):
 
         resource = self.manager.find(other="fake-other-2")
 
-        self.assertEqual(resource.uri, self.resource2.uri)
-        self.assertEqual(resource.name, self.resource2.name)
+        assert resource.uri == self.resource2.uri
+        assert resource.name == self.resource2.name
 
     def test_find_str_two(self):
         """Test BaseManager.find() with two resources matching by a
         string-typed (non-name) resource property."""
-        with self.assertRaises(NoUniqueMatch):
+        with pytest.raises(NoUniqueMatch):
 
             self.manager.find(same="fake-same")
 
     def test_find_int_none(self):
         """Test BaseManager.find() with no resource matching by a
         string-typed (non-name) resource property."""
-        with self.assertRaises(NotFound):
+        with pytest.raises(NotFound):
 
             self.manager.find(int_other=815)
 
@@ -363,13 +362,13 @@ class Manager2Tests(unittest.TestCase):
 
         resource = self.manager.find(int_other=24)
 
-        self.assertEqual(resource.uri, self.resource2.uri)
-        self.assertEqual(resource.name, self.resource2.name)
+        assert resource.uri == self.resource2.uri
+        assert resource.name == self.resource2.name
 
     def test_find_int_two(self):
         """Test BaseManager.find() with two resources matching by a
         string-typed (non-name) resource property."""
-        with self.assertRaises(NoUniqueMatch):
+        with pytest.raises(NoUniqueMatch):
 
             self.manager.find(int_same=42)
 
@@ -377,7 +376,7 @@ class Manager2Tests(unittest.TestCase):
         """Test BaseManager.find_by_name() with no resource matching by the
         name resource property."""
 
-        with self.assertRaises(NotFound):
+        with pytest.raises(NotFound):
             self.manager.find_by_name("not-exists")
 
     def test_find_by_name_one(self):
@@ -386,21 +385,20 @@ class Manager2Tests(unittest.TestCase):
 
         resource = self.manager.find_by_name(self.resource2.name)
 
-        self.assertEqual(resource.uri, self.resource2.uri)
-        self.assertEqual(resource.name, self.resource2.name)
+        assert resource.uri == self.resource2.uri
+        assert resource.name == self.resource2.name
 
 
-class NameUriCacheTests(unittest.TestCase):
+class TestNameUriCache(object):
     """All tests for the _NameUriCache class."""
 
-    def assertDatetimeNear(self, dt1, dt2, max_delta=0.1):
+    def assert_datetime_near(self, dt1, dt2, max_delta=0.1):
         delta = abs(dt2 - dt1).total_seconds()
-        if delta > max_delta:
-            self.fail(
-                "Datetime values are %s s apart, maximum is %s s" %
-                (delta, max_delta))
+        assert delta <= max_delta, \
+            "Datetime values are %s s apart, maximum is %s s" % \
+            (delta, max_delta)
 
-    def setUp(self):
+    def setup_method(self):
         self.session = Session(host='fake-host', userid='fake-user',
                                password='fake-pw')
         self.manager = MyManager(self.session)
@@ -430,10 +428,10 @@ class NameUriCacheTests(unittest.TestCase):
     def test_initial(self):
         """Test initial cache state."""
 
-        self.assertEqual(self.cache._manager, self.manager)
-        self.assertEqual(self.cache._timetolive, self.timetolive)
-        self.assertEqual(self.cache._uris, {})
-        self.assertDatetimeNear(self.cache._invalidated, self.created)
+        assert self.cache._manager == self.manager
+        assert self.cache._timetolive == self.timetolive
+        assert self.cache._uris == {}
+        self.assert_datetime_near(self.cache._invalidated, self.created)
 
     def test_get_no_invalidate(self):
         """Tests for get() without auto-invalidating the cache."""
@@ -442,37 +440,37 @@ class NameUriCacheTests(unittest.TestCase):
         # cache brings all resources into the cache and causes list() to be
         # called once.
         resource1_uri = self.cache.get(self.resource1_name)
-        self.assertEqual(resource1_uri, self.resource1.uri)
-        self.assertEqual(set(self.cache._uris.keys()), self.all_names)
-        self.assertEqual(self.manager._list_called, 1)
+        assert resource1_uri == self.resource1.uri
+        assert set(self.cache._uris.keys()) == self.all_names
+        assert self.manager._list_called == 1
 
         # Check that on the second access of the same name, list() is not
         # called again.
         resource1_uri = self.cache.get(self.resource1_name)
-        self.assertEqual(self.manager._list_called, 1)
+        assert self.manager._list_called == 1
 
     def test_get_non_existing(self):
         """Tests for get() of a non-existing entry."""
 
         # Check that accessing a non-existing resource name raises an
         # exception, but has populated the cache.
-        with self.assertRaises(NotFound):
+        with pytest.raises(NotFound):
             self.cache.get('non-existing')
-        self.assertEqual(set(self.cache._uris.keys()), self.all_names)
-        self.assertEqual(self.manager._list_called, 1)
+        assert set(self.cache._uris.keys()) == self.all_names
+        assert self.manager._list_called == 1
 
     def test_get_auto_invalidate(self):
         """Tests for get() with auto-invalidating the cache."""
 
         # Populate the cache.
         self.cache.get(self.resource1_name)
-        self.assertEqual(self.manager._list_called, 1)
-        self.assertDatetimeNear(self.cache._invalidated, self.created)
+        assert self.manager._list_called == 1
+        self.assert_datetime_near(self.cache._invalidated, self.created)
 
         # Check that on the second access of the same name, list() is not
         # called again.
         self.cache.get(self.resource1_name)
-        self.assertEqual(self.manager._list_called, 1)
+        assert self.manager._list_called == 1
 
         # Wait until the time-to-live has safely passed.
         time.sleep(self.timetolive + 0.2)
@@ -481,33 +479,33 @@ class NameUriCacheTests(unittest.TestCase):
         # again, because the cache now has auto-invalidated.
         self.cache.get(self.resource1_name)
         invalidated = datetime.now()
-        self.assertEqual(self.manager._list_called, 2)
-        self.assertDatetimeNear(self.cache._invalidated, invalidated)
+        assert self.manager._list_called == 2
+        self.assert_datetime_near(self.cache._invalidated, invalidated)
 
     def test_get_manual_invalidate(self):
         """Tests for get() and manual invalidate()."""
 
         # Populate the cache.
         self.cache.get(self.resource1_name)
-        self.assertEqual(self.manager._list_called, 1)
-        self.assertDatetimeNear(self.cache._invalidated, self.created)
+        assert self.manager._list_called == 1
+        self.assert_datetime_near(self.cache._invalidated, self.created)
 
         # Check that on the second access of the same name, list() is not
         # called again.
         self.cache.get(self.resource1_name)
-        self.assertEqual(self.manager._list_called, 1)
+        assert self.manager._list_called == 1
 
         # Manually invalidate the cache.
         self.cache.invalidate()
         invalidated = datetime.now()
-        self.assertDatetimeNear(self.cache._invalidated, invalidated)
-        self.assertEqual(self.cache._uris, {})
+        self.assert_datetime_near(self.cache._invalidated, invalidated)
+        assert self.cache._uris == {}
 
         # Check that on the third access of the same name, list() is called
         # again, because the cache has been invalidated.
         self.cache.get(self.resource1_name)
-        self.assertEqual(self.manager._list_called, 2)
-        self.assertEqual(set(self.cache._uris.keys()), self.all_names)
+        assert self.manager._list_called == 2
+        assert set(self.cache._uris.keys()) == self.all_names
 
     def test_refresh_empty(self):
         """Test refresh() on an empty cache."""
@@ -516,71 +514,71 @@ class NameUriCacheTests(unittest.TestCase):
         # re-populates it.
         self.cache.refresh()
         refreshed = datetime.now()
-        self.assertDatetimeNear(self.cache._invalidated, refreshed)
-        self.assertEqual(self.manager._list_called, 1)
-        self.assertEqual(set(self.cache._uris.keys()), self.all_names)
+        self.assert_datetime_near(self.cache._invalidated, refreshed)
+        assert self.manager._list_called == 1
+        assert set(self.cache._uris.keys()) == self.all_names
 
     def test_refresh_populated(self):
         """Test refresh() on a fully populated cache."""
 
         # Populate the cache.
         self.cache.get(self.resource1_name)
-        self.assertEqual(self.manager._list_called, 1)
-        self.assertDatetimeNear(self.cache._invalidated, self.created)
+        assert self.manager._list_called == 1
+        self.assert_datetime_near(self.cache._invalidated, self.created)
 
         # Refresh the cache and check that this invalidates it and
         # re-populates it.
         self.cache.refresh()
         refreshed = datetime.now()
-        self.assertDatetimeNear(self.cache._invalidated, refreshed)
-        self.assertEqual(self.manager._list_called, 2)
-        self.assertEqual(set(self.cache._uris.keys()), self.all_names)
+        self.assert_datetime_near(self.cache._invalidated, refreshed)
+        assert self.manager._list_called == 2
+        assert set(self.cache._uris.keys()) == self.all_names
 
     def test_delete_existing(self):
         """Test delete() of an existing cache entry, and re-accessing it."""
 
         # Populate the cache.
         self.cache.get(self.resource1_name)
-        self.assertEqual(self.manager._list_called, 1)
-        self.assertDatetimeNear(self.cache._invalidated, self.created)
+        assert self.manager._list_called == 1
+        self.assert_datetime_near(self.cache._invalidated, self.created)
 
         # Delete an existing cache entry and check that the entry is now gone.
         self.cache.delete(self.resource1_name)
-        self.assertEqual(set(self.cache._uris.keys()), {self.resource2_name})
+        assert set(self.cache._uris.keys()) == {self.resource2_name}
 
         # Re-access the deleted entry, and check that list() is called again
         # to get that entry into the cache.
         self.cache.get(self.resource1_name)
-        self.assertEqual(self.manager._list_called, 2)
-        self.assertEqual(set(self.cache._uris.keys()), self.all_names)
+        assert self.manager._list_called == 2
+        assert set(self.cache._uris.keys()) == self.all_names
 
     def test_delete_non_existing(self):
         """Test delete() of a non-existing cache entry."""
 
         # Populate the cache.
         self.cache.get(self.resource1_name)
-        self.assertEqual(self.manager._list_called, 1)
-        self.assertDatetimeNear(self.cache._invalidated, self.created)
+        assert self.manager._list_called == 1
+        self.assert_datetime_near(self.cache._invalidated, self.created)
 
         # Delete a non-existing cache entry and check that no exception is
         # raised and that the cache still contains the same entries.
         self.cache.delete('non-existing')
-        self.assertEqual(self.manager._list_called, 1)
-        self.assertEqual(set(self.cache._uris.keys()), self.all_names)
+        assert self.manager._list_called == 1
+        assert set(self.cache._uris.keys()) == self.all_names
 
     def test_delete_none(self):
         """Test delete() of `None`."""
 
         # Populate the cache.
         self.cache.get(self.resource1_name)
-        self.assertEqual(self.manager._list_called, 1)
-        self.assertDatetimeNear(self.cache._invalidated, self.created)
+        assert self.manager._list_called == 1
+        self.assert_datetime_near(self.cache._invalidated, self.created)
 
         # Delete `None` and check that no exception is raised and that the
         # cache still contains the same entries.
         self.cache.delete(None)
-        self.assertEqual(self.manager._list_called, 1)
-        self.assertEqual(set(self.cache._uris.keys()), self.all_names)
+        assert self.manager._list_called == 1
+        assert set(self.cache._uris.keys()) == self.all_names
 
     def test_update_from_empty(self):
         """Test update_from() on an empty cache."""
@@ -603,9 +601,8 @@ class NameUriCacheTests(unittest.TestCase):
         # Update the cache from these two resources check that they are now in
         # the cache (and that list() has not been called)
         self.cache.update_from([resource3, resource4])
-        self.assertEqual(self.manager._list_called, 0)
-        self.assertEqual(set(self.cache._uris.keys()),
-                         {resource3_name, resource4_name})
+        assert self.manager._list_called == 0
+        assert set(self.cache._uris.keys()) == {resource3_name, resource4_name}
 
     def test_update_from_populated_modify_name(self):
         """Test update_from() on a populated cache and modify the URI of one
@@ -627,23 +624,22 @@ class NameUriCacheTests(unittest.TestCase):
 
         # Populate the cache.
         self.cache.get(self.resource1_name)
-        self.assertEqual(self.manager._list_called, 1)
-        self.assertEqual(set(self.cache._uris.keys()),
-                         {self.resource1_name, self.resource2_name})
+        assert self.manager._list_called == 1
+        assert set(self.cache._uris.keys()) == \
+            {self.resource1_name, self.resource2_name}
 
         # Update the cache from these two resources check that they are now in
         # the cache (and that list() has not been called again).
         self.cache.update_from([resource3, resource2_new])
-        self.assertEqual(self.manager._list_called, 1)
-        self.assertEqual(
-            set(self.cache._uris.keys()),
-            {self.resource1_name, self.resource2_name, resource3_name})
+        assert self.manager._list_called == 1
+        assert set(self.cache._uris.keys()) == \
+            {self.resource1_name, self.resource2_name, resource3_name}
 
         # Access the modified entry, and check that the entry has changed
         # (and that list() has not been called again).
         resource2_uri = self.cache.get(self.resource2_name)
-        self.assertEqual(self.manager._list_called, 1)
-        self.assertEqual(resource2_uri, resource2_new_uri)
+        assert self.manager._list_called == 1
+        assert resource2_uri == resource2_new_uri
 
     def test_update_empty(self):
         """Test update() on an empty cache."""
@@ -653,13 +649,13 @@ class NameUriCacheTests(unittest.TestCase):
 
         # Update the cache, to get the entry added.
         self.cache.update(resource3_name, resource3_uri)
-        self.assertEqual(self.manager._list_called, 0)
+        assert self.manager._list_called == 0
 
         # Access the new entry, and check the entry (and that list() has not
         # been called).
         act_resource3_uri = self.cache.get(resource3_name)
-        self.assertEqual(self.manager._list_called, 0)
-        self.assertEqual(act_resource3_uri, resource3_uri)
+        assert self.manager._list_called == 0
+        assert act_resource3_uri == resource3_uri
 
     def test_update_empty_empty(self):
         """Test update() on an empty cache with an empty resource name."""
@@ -670,8 +666,8 @@ class NameUriCacheTests(unittest.TestCase):
         # Update the cache with the empty resource name, and check that no
         # exception is raised and that the cache is still empty.
         self.cache.update(resource3_name, resource3_uri)
-        self.assertEqual(self.cache._uris, {})
-        self.assertEqual(self.manager._list_called, 0)
+        assert self.cache._uris == {}
+        assert self.manager._list_called == 0
 
     def test_update_empty_none(self):
         """Test update() on an empty cache with a `None` resource name."""
@@ -682,8 +678,8 @@ class NameUriCacheTests(unittest.TestCase):
         # Update the cache with the empty resource name, and check that no
         # exception is raised and that the cache is still empty.
         self.cache.update(resource3_name, resource3_uri)
-        self.assertEqual(self.cache._uris, {})
-        self.assertEqual(self.manager._list_called, 0)
+        assert self.cache._uris == {}
+        assert self.manager._list_called == 0
 
     def test_update_populated_new(self):
         """Test update() on a populated cache with a new entry."""
@@ -693,19 +689,19 @@ class NameUriCacheTests(unittest.TestCase):
 
         # Populate the cache.
         self.cache.get(self.resource1_name)
-        self.assertEqual(self.manager._list_called, 1)
-        self.assertEqual(set(self.cache._uris.keys()),
-                         {self.resource1_name, self.resource2_name})
+        assert self.manager._list_called == 1
+        assert set(self.cache._uris.keys()) == \
+            {self.resource1_name, self.resource2_name}
 
         # Update the cache, to get the new entry added.
         self.cache.update(resource3_name, resource3_uri)
-        self.assertEqual(self.manager._list_called, 1)
+        assert self.manager._list_called == 1
 
         # Access the new entry, and check the entry (and that list() has not
         # been called).
         act_resource3_uri = self.cache.get(resource3_name)
-        self.assertEqual(self.manager._list_called, 1)
-        self.assertEqual(act_resource3_uri, resource3_uri)
+        assert self.manager._list_called == 1
+        assert act_resource3_uri == resource3_uri
 
     def test_update_populated_modify(self):
         """Test update() on a populated cache by modifying an existing
@@ -715,16 +711,16 @@ class NameUriCacheTests(unittest.TestCase):
 
         # Populate the cache.
         self.cache.get(self.resource1_name)
-        self.assertEqual(self.manager._list_called, 1)
-        self.assertEqual(set(self.cache._uris.keys()),
-                         {self.resource1_name, self.resource2_name})
+        assert self.manager._list_called == 1
+        assert set(self.cache._uris.keys()) == \
+            {self.resource1_name, self.resource2_name}
 
         # Update the cache, to get the existing entry modified.
         self.cache.update(self.resource2_name, resource2_new_uri)
-        self.assertEqual(self.manager._list_called, 1)
+        assert self.manager._list_called == 1
 
         # Access the new entry, and check the entry (and that list() has not
         # been called again).
         act_resource2_uri = self.cache.get(self.resource2_name)
-        self.assertEqual(self.manager._list_called, 1)
-        self.assertEqual(act_resource2_uri, resource2_new_uri)
+        assert self.manager._list_called == 1
+        assert act_resource2_uri == resource2_new_uri
diff --git a/tests/unit/test_nic.py b/tests/unit/test_nic.py
old mode 100755
new mode 100644
index 98e6009..3100017
--- a/tests/unit/test_nic.py
+++ b/tests/unit/test_nic.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # Copyright 2016-2017 IBM Corp. All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/tests/unit/test_notification.py b/tests/unit/test_notification.py
index dfe650c..5b20666 100644
--- a/tests/unit/test_notification.py
+++ b/tests/unit/test_notification.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # Copyright 2016-2017 IBM Corp. All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,9 +21,9 @@ requests_mock package.
 
 from __future__ import absolute_import, print_function
 
-import unittest
 import json
 import threading
+# FIXME: Migrate mock to zhmcclient_mock.
 from mock import patch
 
 from zhmcclient._notification import NotificationReceiver
@@ -125,9 +124,9 @@ def receive_notifications(receiver):
     return msg_items
 
 
-class NotificationTests(unittest.TestCase):
+class TestNotification(object):
 
-    def setUp(self):
+    def setup_method(self):
         self.topic = 'fake-topic'
         self.hmc = 'fake-hmc'
         self.userid = 'fake-userid'
@@ -148,7 +147,7 @@ class NotificationTests(unittest.TestCase):
         conn.mock_start()
         msg_items = receive_notifications(receiver)
 
-        self.assertEqual(msg_items, [])
+        assert msg_items == []
 
     @patch(target='stomp.Connection', new=MockedStompConnection)
     def test_one_message(self):
@@ -163,8 +162,8 @@ class NotificationTests(unittest.TestCase):
         conn.mock_start()
         msg_items = receive_notifications(receiver)
 
-        self.assertEqual(len(msg_items), 1)
+        assert len(msg_items) == 1
 
         msg0 = msg_items[0]
-        self.assertEqual(msg0[0], self.std_headers)
-        self.assertEqual(msg0[1], message_obj)
+        assert msg0[0] == self.std_headers
+        assert msg0[1] == message_obj
diff --git a/tests/unit/test_port.py b/tests/unit/test_port.py
old mode 100755
new mode 100644
index acc2e55..10c0f16
--- a/tests/unit/test_port.py
+++ b/tests/unit/test_port.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # Copyright 2016-2017 IBM Corp. All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,16 +18,16 @@ Unit tests for _port module.
 
 from __future__ import absolute_import, print_function
 
-import unittest
+# FIXME: Migrate requests_mock to zhmcclient_mock.
 import requests_mock
 
 from zhmcclient import Session, Client
 
 
-class PortTests(unittest.TestCase):
+class TestPort(object):
     """All tests for Port and PortManager classes."""
 
-    def setUp(self):
+    def setup_method(self):
         self.session = Session('port-dpm-host', 'port-user',
                                'port-pwd')
         self.client = Client(self.session)
@@ -110,7 +109,7 @@ class PortTests(unittest.TestCase):
             adapters = adapter_mgr.list(full_properties=False)
             self.adapters = adapters
 
-    def tearDown(self):
+    def teardown_method(self):
         with requests_mock.mock() as m:
             m.delete('/api/sessions/this-session', status_code=204)
             self.session.logoff()
@@ -118,7 +117,7 @@ class PortTests(unittest.TestCase):
     def test_init(self):
         """Test __init__() on PortManager instance in Adapter."""
         port_mgr = self.adapters[0].ports
-        self.assertEqual(port_mgr.adapter, self.adapters[0])
+        assert port_mgr.adapter == self.adapters[0]
 
     def test_list_short_ok(self):
         """
@@ -139,15 +138,15 @@ class PortTests(unittest.TestCase):
                 else:
                     network_uris = result_adapter['network-port-uris']
                     uris = network_uris
-                self.assertEqual(adapter.properties['port-count'], len(uris))
+                assert adapter.properties['port-count'] == len(uris)
             else:
                 uris = []
 
-            self.assertEqual(len(ports), len(uris))
+            assert len(ports) == len(uris)
             for idx, port in enumerate(ports):
-                self.assertTrue(port.properties['element-uri'] in uris)
-                self.assertFalse(port.full_properties)
-                self.assertEqual(port.manager, port_mgr)
+                assert port.properties['element-uri'] in uris
+                assert not port.full_properties
+                assert port.manager == port_mgr
 
     def test_list_full_ok(self):
         """
@@ -177,18 +176,15 @@ class PortTests(unittest.TestCase):
             ports = port_mgr.list(full_properties=True)
             if len(ports) != 0:
                 storage_uris = self.result['adapters'][0]['storage-port-uris']
-                self.assertEqual(adapter.properties['port-count'],
-                                 len(storage_uris))
+                assert adapter.properties['port-count'] == len(storage_uris)
             else:
                 storage_uris = []
 
-            self.assertEqual(len(ports), len(storage_uris))
+            assert len(ports) == len(storage_uris)
             for idx, port in enumerate(ports):
-                self.assertEqual(
-                    port.properties['element-uri'],
-                    storage_uris[idx])
-                self.assertTrue(port.full_properties)
-                self.assertEqual(port.manager, port_mgr)
+                assert port.properties['element-uri'] == storage_uris[idx]
+                assert port.full_properties
+                assert port.manager == port_mgr
 
     def test_list_filter_name_ok(self):
         """
@@ -218,15 +214,14 @@ class PortTests(unittest.TestCase):
             filter_args = {'name': 'Port 0'}
             ports = port_mgr.list(filter_args=filter_args)
 
-            self.assertEqual(len(ports), 1)
+            assert len(ports) == 1
             port = ports[0]
-            self.assertEqual(port.name, 'Port 0')
-            self.assertEqual(
-                port.uri,
-                '/api/adapters/fake-adapter-id-1/storage-ports/0')
-            self.assertEqual(port.properties['name'], 'Port 0')
-            self.assertEqual(port.properties['element-id'], '0')
-            self.assertEqual(port.manager, port_mgr)
+            assert port.name == 'Port 0'
+            assert port.uri == \
+                '/api/adapters/fake-adapter-id-1/storage-ports/0'
+            assert port.properties['name'] == 'Port 0'
+            assert port.properties['element-id'] == '0'
+            assert port.manager == port_mgr
 
     def test_list_filter_elementid_ok(self):
         """
@@ -256,15 +251,14 @@ class PortTests(unittest.TestCase):
             filter_args = {'element-id': '0'}
             ports = port_mgr.list(filter_args=filter_args)
 
-            self.assertEqual(len(ports), 1)
+            assert len(ports) == 1
             port = ports[0]
-            self.assertEqual(port.name, 'Port 0')
-            self.assertEqual(
-                port.uri,
-                '/api/adapters/fake-adapter-id-1/storage-ports/0')
-            self.assertEqual(port.properties['name'], 'Port 0')
-            self.assertEqual(port.properties['element-id'], '0')
-            self.assertEqual(port.manager, port_mgr)
+            assert port.name == 'Port 0'
+            assert port.uri == \
+                '/api/adapters/fake-adapter-id-1/storage-ports/0'
+            assert port.properties['name'] == 'Port 0'
+            assert port.properties['element-id'] == '0'
+            assert port.manager == port_mgr
 
     def test_update_properties(self):
         """
@@ -277,7 +271,3 @@ class PortTests(unittest.TestCase):
             m.post('/api/adapters/fake-adapter-id-1/storage-ports/0',
                    status_code=204)
             port.update_properties(properties={})
-
-
-if __name__ == '__main__':
-    unittest.main()
diff --git a/tests/unit/test_resource.py b/tests/unit/test_resource.py
old mode 100755
new mode 100644
index 496aebe..7149568
--- a/tests/unit/test_resource.py
+++ b/tests/unit/test_resource.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # Copyright 2016-2017 IBM Corp. All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,8 +18,8 @@ Unit tests for _resource module.
 
 from __future__ import absolute_import, print_function
 
-import unittest
 import time
+import re
 from collections import OrderedDict
 
 from zhmcclient import BaseResource, BaseManager, Session
@@ -66,12 +65,12 @@ class MyManager(BaseManager):
         raise NotImplemented
 
 
-class ResourceTestCase(unittest.TestCase):
+class ResourceTestCase(object):
     """
     Base class for all tests in this file.
     """
 
-    def setUp(self):
+    def setup_method(self):
         self.session = Session(host='fake-host')
         self.mgr = MyManager(self.session)
         self.uri = self.mgr._base_uri + '/deadbeef-beef-beef-beef-deadbeefbeef'
@@ -85,23 +84,21 @@ class ResourceTestCase(unittest.TestCase):
         """
 
         # Check that the properties member is a dict
-        self.assertTrue(isinstance(resource.properties, dict))
+        assert isinstance(resource.properties, dict)
 
         # Verify that the resource properties are as expected
-        self.assertEqual(
-            len(resource.properties), len(exp_props),
-            "Set of properties does not match. Expected {!r}, got {!r}".
-            format(resource.properties.keys(), exp_props.keys()))
+        assert len(resource.properties) == len(exp_props), \
+            "Set of properties does not match. Expected {!r}, got {!r}". \
+            format(resource.properties.keys(), exp_props.keys())
 
         for name, exp_value in exp_props.items():
             act_value = resource.properties[name]
-            self.assertEqual(
-                act_value, exp_value,
-                "Property {!r} does not match. Expected {!r}, got {!r}".
-                format(name, exp_value, act_value))
+            assert act_value == exp_value, \
+                "Property {!r} does not match. Expected {!r}, got {!r}". \
+                format(name, exp_value, act_value)
 
 
-class InitTests(ResourceTestCase):
+class TestInit(ResourceTestCase):
     """Test BaseResource initialization."""
 
     def test_empty_name(self):
@@ -114,12 +111,12 @@ class InitTests(ResourceTestCase):
 
         res = MyResource(self.mgr, self.uri, self.name, init_props)
 
-        self.assertTrue(res.manager is self.mgr)
-        self.assertEqual(res.uri, self.uri)
-        self.assertEqual(res.name, self.name)
+        assert res.manager is self.mgr
+        assert res.uri == self.uri
+        assert res.name == self.name
         self.assert_properties(res, res_props)
-        self.assertTrue(int(time.time()) - res.properties_timestamp <= 1)
-        self.assertEqual(res.full_properties, False)
+        assert int(time.time()) - res.properties_timestamp <= 1
+        assert res.full_properties is False
 
     def test_empty_no_name(self):
         """Test with an empty set of input properties, without 'name'."""
@@ -130,11 +127,11 @@ class InitTests(ResourceTestCase):
 
         res = MyResource(self.mgr, self.uri, None, init_props)
 
-        self.assertTrue(res.manager is self.mgr)
-        self.assertEqual(res.uri, self.uri)
+        assert res.manager is self.mgr
+        assert res.uri == self.uri
         self.assert_properties(res, res_props)
-        self.assertTrue(int(time.time()) - res.properties_timestamp <= 1)
-        self.assertEqual(res.full_properties, False)
+        assert int(time.time()) - res.properties_timestamp <= 1
+        assert res.full_properties is False
 
     def test_simple(self):
         """Test with a simple set of input properties."""
@@ -150,11 +147,11 @@ class InitTests(ResourceTestCase):
 
         res = MyResource(self.mgr, self.uri, None, init_props)
 
-        self.assertTrue(res.manager is self.mgr)
-        self.assertEqual(res.uri, self.uri)
+        assert res.manager is self.mgr
+        assert res.uri == self.uri
         self.assert_properties(res, res_props)
-        self.assertTrue(int(time.time()) - res.properties_timestamp <= 1)
-        self.assertEqual(res.full_properties, False)
+        assert int(time.time()) - res.properties_timestamp <= 1
+        assert res.full_properties is False
 
     def test_prop_case(self):
         """Test case sensitivity for the input properties."""
@@ -170,11 +167,11 @@ class InitTests(ResourceTestCase):
 
         res = MyResource(self.mgr, self.uri, None, init_props)
 
-        self.assertTrue(res.manager is self.mgr)
-        self.assertEqual(res.uri, self.uri)
+        assert res.manager is self.mgr
+        assert res.uri == self.uri
         self.assert_properties(res, res_props)
-        self.assertTrue(int(time.time()) - res.properties_timestamp <= 1)
-        self.assertEqual(res.full_properties, False)
+        assert int(time.time()) - res.properties_timestamp <= 1
+        assert res.full_properties is False
 
     def test_invalid_type(self):
         """Test that input properties with an invalid type fail."""
@@ -201,10 +198,9 @@ class InitTests(ResourceTestCase):
 
         str_str = str_str.replace('\n', '\\n')
         # We check just the begin of the string:
-        self.assertRegexpMatches(
-            str_str,
-            r'^{classname}\s*\(.*'.format(
-                classname=resource.__class__.__name__))
+        assert re.match(r'^{classname}\s*\(.*'.
+                        format(classname=resource.__class__.__name__),
+                        str_str)
 
     def test_repr(self):
         """Test BaseResource.__repr__()."""
@@ -218,14 +214,13 @@ class InitTests(ResourceTestCase):
 
         repr_str = repr_str.replace('\n', '\\n')
         # We check just the begin of the string:
-        self.assertRegexpMatches(
-            repr_str,
-            r'^{classname}\s+at\s+0x{id:08x}\s+\(\\n.*'.format(
-                classname=resource.__class__.__name__,
-                id=id(resource)))
+        assert re.match(r'^{classname}\s+at\s+0x{id:08x}\s+\(\\n.*'.
+                        format(classname=resource.__class__.__name__,
+                               id=id(resource)),
+                        repr_str)
 
 
-class PropertySetTests(ResourceTestCase):
+class TestPropertySet(ResourceTestCase):
     """Test BaseResource by setting properties."""
 
     def test_add_to_empty(self):
@@ -271,7 +266,7 @@ class PropertySetTests(ResourceTestCase):
         self.assert_properties(res, res_props)
 
 
-class PropertyDelTests(ResourceTestCase):
+class TestPropertyDel(ResourceTestCase):
     """Test BaseResource by deleting properties."""
 
     def test_del_one(self):
@@ -344,10 +339,10 @@ class PropertyDelTests(ResourceTestCase):
 
         res.properties.clear()
 
-        self.assertEqual(len(res.properties), 0)
+        assert len(res.properties) == 0
 
 
-class ManagerDivideFilterTests(ResourceTestCase):
+class TestManagerDivideFilter(ResourceTestCase):
     """Test the _divide_filter_args() method of BaseManager."""
 
     # Reserved chars are defined in RFC 3986 as gen-delims and sub-delims.
@@ -369,8 +364,8 @@ class ManagerDivideFilterTests(ResourceTestCase):
 
         parm_str, cf_args = self.mgr._divide_filter_args(filter_args)
 
-        self.assertEqual(parm_str, '')
-        self.assertEqual(cf_args, {})
+        assert parm_str == ''
+        assert cf_args == {}
 
     def test_empty(self):
         """Test with an empty set of filter arguments."""
@@ -378,8 +373,8 @@ class ManagerDivideFilterTests(ResourceTestCase):
 
         parm_str, cf_args = self.mgr._divide_filter_args(filter_args)
 
-        self.assertEqual(parm_str, '')
-        self.assertEqual(cf_args, {})
+        assert parm_str == ''
+        assert cf_args == {}
 
     def test_one_string_qp(self):
         """Test with one string filter argument that is a query parm."""
@@ -387,8 +382,8 @@ class ManagerDivideFilterTests(ResourceTestCase):
 
         parm_str, cf_args = self.mgr._divide_filter_args(filter_args)
 
-        self.assertEqual(parm_str, '?qp1=bar')
-        self.assertEqual(cf_args, {})
+        assert parm_str == '?qp1=bar'
+        assert cf_args == {}
 
     def test_one_string_cf(self):
         """Test with one string filter argument that is a client filter."""
@@ -396,8 +391,8 @@ class ManagerDivideFilterTests(ResourceTestCase):
 
         parm_str, cf_args = self.mgr._divide_filter_args(filter_args)
 
-        self.assertEqual(parm_str, '')
-        self.assertEqual(cf_args, {'foo': 'bar'})
+        assert parm_str == ''
+        assert cf_args == {'foo': 'bar'}
 
     def test_one_integer_qp(self):
         """Test with one integer filter argument that is a query parm."""
@@ -405,8 +400,8 @@ class ManagerDivideFilterTests(ResourceTestCase):
 
         parm_str, cf_args = self.mgr._divide_filter_args(filter_args)
 
-        self.assertEqual(parm_str, '?qp2=42')
-        self.assertEqual(cf_args, {})
+        assert parm_str == '?qp2=42'
+        assert cf_args == {}
 
     def test_one_integer_cf(self):
         """Test with one integer filter argument that is a client filter."""
@@ -414,8 +409,8 @@ class ManagerDivideFilterTests(ResourceTestCase):
 
         parm_str, cf_args = self.mgr._divide_filter_args(filter_args)
 
-        self.assertEqual(parm_str, '')
-        self.assertEqual(cf_args, {'foo': 42})
+        assert parm_str == ''
+        assert cf_args == {'foo': 42}
 
     def test_one_str_reserved_val_qp(self):
         """Test with one string filter argument with reserved URI chars in
@@ -426,8 +421,8 @@ class ManagerDivideFilterTests(ResourceTestCase):
 
         parm_str, cf_args = self.mgr._divide_filter_args(filter_args)
 
-        self.assertEqual(parm_str, '?qp1={}'.format(escape_str))
-        self.assertEqual(cf_args, {})
+        assert parm_str == '?qp1={}'.format(escape_str)
+        assert cf_args == {}
 
     def test_one_str_reserved_val_cf(self):
         """Test with one string filter argument with reserved URI chars in
@@ -437,8 +432,8 @@ class ManagerDivideFilterTests(ResourceTestCase):
 
         parm_str, cf_args = self.mgr._divide_filter_args(filter_args)
 
-        self.assertEqual(parm_str, '')
-        self.assertEqual(cf_args, {'foo': char_str})
+        assert parm_str == ''
+        assert cf_args == {'foo': char_str}
 
     def test_one_str_dash_name_qp(self):
         """Test with one string filter argument with a dash in its name that is
@@ -448,8 +443,8 @@ class ManagerDivideFilterTests(ResourceTestCase):
 
         parm_str, cf_args = self.mgr._divide_filter_args(filter_args)
 
-        self.assertEqual(parm_str, '?foo-boo=bar')
-        self.assertEqual(cf_args, {})
+        assert parm_str == '?foo-boo=bar'
+        assert cf_args == {}
 
     def test_one_str_reserved_name_qp(self):
         """Test with one string filter argument with reserved URI chars in
@@ -461,8 +456,8 @@ class ManagerDivideFilterTests(ResourceTestCase):
 
         parm_str, cf_args = self.mgr._divide_filter_args(filter_args)
 
-        self.assertEqual(parm_str, '?{}=bar'.format(escape_str))
-        self.assertEqual(cf_args, {})
+        assert parm_str == '?{}=bar'.format(escape_str)
+        assert cf_args == {}
 
     def test_two_qp(self):
         """Test with two filter arguments that are query parms."""
@@ -470,8 +465,8 @@ class ManagerDivideFilterTests(ResourceTestCase):
 
         parm_str, cf_args = self.mgr._divide_filter_args(filter_args)
 
-        self.assertEqual(parm_str, '?qp1=bar&qp2=42')
-        self.assertEqual(cf_args, {})
+        assert parm_str == '?qp1=bar&qp2=42'
+        assert cf_args == {}
 
     def test_two_qp_cf(self):
         """Test with two filter arguments where one is a query parm and one is
@@ -480,8 +475,8 @@ class ManagerDivideFilterTests(ResourceTestCase):
 
         parm_str, cf_args = self.mgr._divide_filter_args(filter_args)
 
-        self.assertEqual(parm_str, '?qp1=bar')
-        self.assertEqual(cf_args, {'foo': 42})
+        assert parm_str == '?qp1=bar'
+        assert cf_args == {'foo': 42}
 
     def test_two_cf_qp(self):
         """Test with two filter arguments where one is a client filter and one
@@ -490,8 +485,8 @@ class ManagerDivideFilterTests(ResourceTestCase):
 
         parm_str, cf_args = self.mgr._divide_filter_args(filter_args)
 
-        self.assertEqual(parm_str, '?qp1=42')
-        self.assertEqual(cf_args, {'foo': 'bar'})
+        assert parm_str == '?qp1=42'
+        assert cf_args == {'foo': 'bar'}
 
     def test_two_two_qp(self):
         """Test with two filter arguments, one of which is a list of two, and
@@ -500,8 +495,8 @@ class ManagerDivideFilterTests(ResourceTestCase):
 
         parm_str, cf_args = self.mgr._divide_filter_args(filter_args)
 
-        self.assertEqual(parm_str, '?qp1=bar&qp2=42&qp2=7')
-        self.assertEqual(cf_args, {})
+        assert parm_str == '?qp1=bar&qp2=42&qp2=7'
+        assert cf_args == {}
 
     def test_two_str_reserved_val_qp(self):
         """Test with two filter arguments, one of which is a list of two, and
@@ -512,9 +507,5 @@ class ManagerDivideFilterTests(ResourceTestCase):
 
         parm_str, cf_args = self.mgr._divide_filter_args(filter_args)
 
-        self.assertEqual(parm_str, '?qp1=bar&qp2=42&qp2={}'.format(escape_str))
-        self.assertEqual(cf_args, {})
-
-
-if __name__ == '__main__':
-    unittest.main()
+        assert parm_str == '?qp1=bar&qp2=42&qp2={}'.format(escape_str)
+        assert cf_args == {}
diff --git a/tests/unit/test_session.py b/tests/unit/test_session.py
old mode 100755
new mode 100644
index 604c23d..3a3538f
--- a/tests/unit/test_session.py
+++ b/tests/unit/test_session.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # Copyright 2016-2017 IBM Corp. All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,18 +18,21 @@ Unit tests for _session module.
 
 from __future__ import absolute_import, print_function
 
-import unittest
-import requests
-import requests_mock
 import time
 import json
+import re
+import requests
+import requests_mock
+import mock
+import pytest
 
-from zhmcclient import Session, ParseError, Job, HTTPError, OperationTimeout
+from zhmcclient import Session, ParseError, Job, HTTPError, OperationTimeout, \
+    ClientAuthError
 
 
-class SessionTests(unittest.TestCase):
+class TestSession(object):
     """
-    Test the ``Session`` class.
+    All tests for the Session class.
     """
 
     # TODO: Test Session.get() in all variations (including errors)
@@ -50,22 +52,49 @@ class SessionTests(unittest.TestCase):
                        headers={'X-Request-Id': 'fake-request-id'},
                        status_code=204)
 
-    def test_init(self):
+    @pytest.mark.parametrize(
+        "host, userid, password, use_get_password, session_id", [
+            ('fake-host', None, None, False, None),
+            ('fake-host', 'fake-userid', None, False, None),
+            ('fake-host', 'fake-userid', 'fake-pw', False, None),
+            ('fake-host', 'fake-userid', 'fake-pw', True, None),
+        ]
+    )
+    def test_init(self, host, userid, password, use_get_password, session_id):
         """Test initialization of Session object."""
 
-        session = Session('fake-host', 'fake-user', 'fake-pw')
+        # TODO: Add support for input parameter: retry_timeout_config
+        # TODO: Add support for input parameter: time_stats_keeper
+
+        if use_get_password:
+            def get_password(host, userid):
+                pw = 'fake-pw-{}-{}'.format(host, userid)
+                return pw
+        else:
+            get_password = None
+
+        session = Session(host, userid, password, session_id, get_password)
 
-        self.assertEqual(session.host, 'fake-host')
-        self.assertEqual(session.userid, 'fake-user')
-        self.assertEqual(session._password, 'fake-pw')
-        base_url = 'https://' + session.host + ':6794'
-        self.assertEqual(session.base_url, base_url)
-        self.assertTrue('Content-type' in session.headers)
-        self.assertTrue('Accept' in session.headers)
-        self.assertEqual(len(session.headers), 2)
-        self.assertIsNone(session.session_id)
-        self.assertTrue('X-API-Session' not in session.headers)
-        self.assertIsNone(session.session)
+        assert session.host == host
+        assert session.userid == userid
+        assert session._password == password
+        assert session.session_id == session_id
+        assert session.get_password == get_password
+
+        base_url = 'https://{}:6794'.format(session.host)
+        assert session.base_url == base_url
+
+        assert session.headers['Content-type'] == 'application/json'
+        assert session.headers['Accept'] == '*/*'
+
+        if session_id is None:
+            assert session.session is None
+            assert 'X-API-Session' not in session.headers
+            assert len(session.headers) == 2
+        else:
+            assert isinstance(session.session, requests.Session)
+            assert session.headers['X-API-Session'] == session_id
+            assert len(session.headers) == 3
 
     def test_repr(self):
         """Test Session.__repr__()."""
@@ -76,47 +105,100 @@ class SessionTests(unittest.TestCase):
 
         repr_str = repr_str.replace('\n', '\\n')
         # We check just the begin of the string:
-        self.assertRegexpMatches(
-            repr_str,
-            r'^{classname}\s+at\s+0x{id:08x}\s+\(\\n.*'.format(
-                classname=session.__class__.__name__,
-                id=id(session)))
+        assert re.match(r'^{classname}\s+at\s+0x{id:08x}\s+\(\\n.*'.
+                        format(classname=session.__class__.__name__,
+                               id=id(session)),
+                        repr_str)
+
+    @pytest.mark.parametrize(
+        "host, userid, password, use_get_password, exp_exc", [
+            ('fake-host', None, None, False, ClientAuthError),
+            ('fake-host', 'fake-userid', None, False, ClientAuthError),
+            ('fake-host', 'fake-userid', 'fake-pw', False, None),
+            ('fake-host', 'fake-userid', 'fake-pw', True, None),
+            ('fake-host', 'fake-userid', None, True, None),
+        ]
+    )
+    def test_logon(
+            self, host, userid, password, use_get_password, exp_exc):
+        """Test Session.logon() (and also Session.is_logon())."""
+
+        with requests_mock.Mocker() as m:
 
-    @requests_mock.mock()
-    def test_logon_logoff(self, m):
-        """Test logon and logoff; this uses post() and delete()."""
+            self.mock_server_1(m)
 
-        self.mock_server_1(m)
+            if use_get_password:
+                get_password = mock.MagicMock()
+                get_password.return_value = \
+                    'fake-pw-{}-{}'.format(host, userid)
+            else:
+                get_password = None
 
-        session = Session('fake-host', 'fake-user', 'fake-pw')
+            # Create a session in logged-off state
+            session = Session(host, userid, password, None, get_password)
+
+            assert session.session_id is None
+            assert 'X-API-Session' not in session.headers
+            assert session.session is None
+
+            logged_on = session.is_logon()
+            assert not logged_on
 
-        self.assertIsNone(session.session_id)
-        self.assertTrue('X-API-Session' not in session.headers)
-        self.assertIsNone(session.session)
+            if exp_exc:
+                try:
 
-        logged_on = session.is_logon()
+                    # The code to be tested:
+                    session.logon()
 
-        self.assertFalse(logged_on)
+                except exp_exc:
+                    pass
 
-        session.logon()
+                logged_on = session.is_logon()
+                assert not logged_on
+            else:
 
-        self.assertEqual(session.session_id, 'fake-session-id')
-        self.assertTrue('X-API-Session' in session.headers)
-        self.assertTrue(isinstance(session.session, requests.Session))
+                # The code to be tested:
+                session.logon()
 
-        logged_on = session.is_logon()
+                assert session.session_id == 'fake-session-id'
+                assert 'X-API-Session' in session.headers
+                assert isinstance(session.session, requests.Session)
 
-        self.assertTrue(logged_on)
+                if get_password:
+                    if password is None:
+                        get_password.assert_called_with(host, userid)
+                        assert session._password == get_password.return_value
+                    else:
+                        get_password.assert_not_called()
 
-        session.logoff()
+                logged_on = session.is_logon()
+                assert logged_on
 
-        self.assertIsNone(session.session_id)
-        self.assertTrue('X-API-Session' not in session.headers)
-        self.assertIsNone(session.session)
+    def test_logoff(self):
+        """Test Session.logoff() (and also Session.is_logon())."""
 
-        logged_on = session.is_logon()
+        with requests_mock.Mocker() as m:
 
-        self.assertFalse(logged_on)
+            self.mock_server_1(m)
+
+            # Create a session in logged-off state
+            session = Session('fake-host', 'fake-userid', 'fake-pw')
+
+            session.logon()
+
+            logged_on = session.is_logon()
+            assert logged_on
+
+            # The code to be tested:
+            session.logoff()
+
+            assert session.session_id is None
+            assert session.session is None
+            assert 'X-API-Session' not in session.headers
+            assert len(session.headers) == 2
+
+            logged_on = session.is_logon()
+            assert not logged_on
 
     def _do_parse_error_logon(self, m, json_content, exp_msg_pattern, exp_line,
                               exp_col):
@@ -140,16 +222,22 @@ class SessionTests(unittest.TestCase):
             r"Response status .*" % \
             exp_msg_pattern
 
-        with self.assertRaisesRegexp(ParseError, exp_pe_pattern) as cm:
+        with pytest.raises(ParseError) as exc_info:
             session.logon()
-        self.assertEqual(cm.exception.line, exp_line)
-        self.assertEqual(cm.exception.column, exp_col)
+        exc = exc_info.value
+
+        assert re.match(exp_pe_pattern, str(exc))
+        assert exc.line == exp_line
+        assert exc.column == exp_col
+
+    # TODO: Merge the next 3 test functions into one that is parametrized
 
     @requests_mock.mock()
-    def test_logon_error_invalid_delim(self, m):
+    def test_logon_error_invalid_delim(self, *args):
         """
         Logon with invalid JSON response that has an invalid delimiter.
         """
+        m = args[0]
         json_content = b'{\n"api-session"; "fake-session-id"\n}'
         exp_msg_pattern = r"Expecting ':' delimiter: .*"
         exp_line = 2
@@ -158,10 +246,11 @@ class SessionTests(unittest.TestCase):
                                    exp_col)
 
     @requests_mock.mock()
-    def test_logon_error_invalid_quotes(self, m):
+    def test_logon_error_invalid_quotes(self, *args):
         """
         Logon with invalid JSON response that incorrectly uses single quotes.
         """
+        m = args[0]
         json_content = b'{\'api-session\': \'fake-session-id\'}'
         exp_msg_pattern = r"Expecting property name enclosed in double " \
             "quotes: .*"
@@ -171,10 +260,11 @@ class SessionTests(unittest.TestCase):
                                    exp_col)
 
     @requests_mock.mock()
-    def test_logon_error_extra_closing(self, m):
+    def test_logon_error_extra_closing(self, *args):
         """
         Logon with invalid JSON response that has an extra closing brace.
         """
+        m = args[0]
         json_content = b'{"api-session": "fake-session-id"}}'
         exp_msg_pattern = r"Extra data: .*"
         exp_line = 1
@@ -217,7 +307,7 @@ class SessionTests(unittest.TestCase):
 
             result = session.get_notification_topics()
 
-            self.assertEqual(result, gnt_result['topics'])
+            assert result == gnt_result['topics']
 
             m.delete('/api/sessions/this-session', status_code=204)
 
@@ -268,18 +358,18 @@ class SessionTests(unittest.TestCase):
                 "Console Configuration Error: " \
                 "Web Services API is not enabled on the HMC."
 
-            with self.assertRaises(HTTPError) as cm:
+            with pytest.raises(HTTPError) as exc_info:
                 session.get(get_uri, logon_required=False)
-            exc = cm.exception
+            exc = exc_info.value
 
-            self.assertEqual(exc.http_status, get_resp_status)
-            self.assertEqual(exc.reason, exp_reason)
-            self.assertEqual(exc.message, exp_message)
-            self.assertTrue(exc.request_uri.endswith(get_uri))
-            self.assertEqual(exc.request_method, 'GET')
+            assert exc.http_status == get_resp_status
+            assert exc.reason == exp_reason
+            assert exc.message == exp_message
+            assert exc.request_uri.endswith(get_uri)
+            assert exc.request_method == 'GET'
 
 
-class JobTests(unittest.TestCase):
+class TestJob(object):
     """
     Test the ``Job`` class.
     """
@@ -299,6 +389,8 @@ class JobTests(unittest.TestCase):
                        headers={'X-Request-Id': 'fake-request-id'},
                        status_code=204)
 
+    # TODO: Add parametrization to the next test function.
+
     def test_init(self):
         """Test initialization of Job object."""
         session = Session('fake-host', 'fake-user', 'fake-pw')
@@ -311,10 +403,12 @@ class JobTests(unittest.TestCase):
 
         job = Job(session, self.job_uri, op_method, op_uri)
 
-        self.assertEqual(job.uri, self.job_uri)
-        self.assertEqual(job.session, session)
-        self.assertEqual(job.op_method, op_method)
-        self.assertEqual(job.op_uri, op_uri)
+        assert job.uri == self.job_uri
+        assert job.session == session
+        assert job.op_method == op_method
+        assert job.op_uri == op_uri
+
+    # TODO: Merge the next 7 test functions into one that is parametrized
 
     def test_check_incomplete(self):
         """Test check_for_completion() with incomplete job."""
@@ -332,8 +426,8 @@ class JobTests(unittest.TestCase):
 
             job_status, op_result = job.check_for_completion()
 
-            self.assertEqual(job_status, 'running')
-            self.assertIsNone(op_result)
+            assert job_status == 'running'
+            assert op_result is None
 
     def test_check_complete_success_noresult(self):
         """Test check_for_completion() with successful complete job without
@@ -355,8 +449,8 @@ class JobTests(unittest.TestCase):
 
             job_status, op_result = job.check_for_completion()
 
-            self.assertEqual(job_status, 'complete')
-            self.assertIsNone(op_result)
+            assert job_status == 'complete'
+            assert op_result is None
 
     def test_check_complete_success_result(self):
         """Test check_for_completion() with successful complete job with a
@@ -381,8 +475,8 @@ class JobTests(unittest.TestCase):
 
             job_status, op_result = job.check_for_completion()
 
-            self.assertEqual(job_status, 'complete')
-            self.assertEqual(op_result, exp_op_result)
+            assert job_status == 'complete'
+            assert op_result == exp_op_result
 
     def test_check_complete_error1(self):
         """Test check_for_completion() with complete job in error (1)."""
@@ -402,12 +496,13 @@ class JobTests(unittest.TestCase):
             m.get(self.job_uri, json=query_job_status_result)
             m.delete(self.job_uri, status_code=204)
 
-            with self.assertRaises(HTTPError) as cm:
+            with pytest.raises(HTTPError) as exc_info:
                 job_status, op_result = job.check_for_completion()
+            exc = exc_info.value
 
-            self.assertEqual(cm.exception.http_status, 500)
-            self.assertEqual(cm.exception.reason, 42)
-            self.assertEqual(cm.exception.message, None)
+            assert exc.http_status == 500
+            assert exc.reason == 42
+            assert exc.message is None
 
     def test_check_complete_error2(self):
         """Test check_for_completion() with complete job in error (2)."""
@@ -427,12 +522,13 @@ class JobTests(unittest.TestCase):
             m.get(self.job_uri, json=query_job_status_result)
             m.delete(self.job_uri, status_code=204)
 
-            with self.assertRaises(HTTPError) as cm:
+            with pytest.raises(HTTPError) as exc_info:
                 job_status, op_result = job.check_for_completion()
+            exc = exc_info.value
 
-            self.assertEqual(cm.exception.http_status, 500)
-            self.assertEqual(cm.exception.reason, 42)
-            self.assertEqual(cm.exception.message, None)
+            assert exc.http_status == 500
+            assert exc.reason == 42
+            assert exc.message is None
 
     def test_check_complete_error3(self):
         """Test check_for_completion() with complete job in error (3)."""
@@ -456,12 +552,13 @@ class JobTests(unittest.TestCase):
             m.get(self.job_uri, json=query_job_status_result)
             m.delete(self.job_uri, status_code=204)
 
-            with self.assertRaises(HTTPError) as cm:
+            with pytest.raises(HTTPError) as exc_info:
                 job_status, op_result = job.check_for_completion()
+            exc = exc_info.value
 
-            self.assertEqual(cm.exception.http_status, 500)
-            self.assertEqual(cm.exception.reason, 42)
-            self.assertEqual(cm.exception.message, 'bla message')
+            assert exc.http_status == 500
+            assert exc.reason == 42
+            assert exc.message == 'bla message'
 
     def test_check_complete_error4(self):
         """Test check_for_completion() with complete job in error (4)."""
@@ -485,12 +582,15 @@ class JobTests(unittest.TestCase):
             m.get(self.job_uri, json=query_job_status_result)
             m.delete(self.job_uri, status_code=204)
 
-            with self.assertRaises(HTTPError) as cm:
+            with pytest.raises(HTTPError) as exc_info:
                 job_status, op_result = job.check_for_completion()
+            exc = exc_info.value
+
+            assert exc.http_status == 500
+            assert exc.reason == 42
+            assert exc.message == 'bla message'
 
-            self.assertEqual(cm.exception.http_status, 500)
-            self.assertEqual(cm.exception.reason, 42)
-            self.assertEqual(cm.exception.message, 'bla message')
+    # TODO: Merge the next 3 test functions into one that is parametrized
 
     def test_wait_complete1_success_result(self):
         """Test wait_for_completion() with successful complete job with a
@@ -515,7 +615,7 @@ class JobTests(unittest.TestCase):
 
             op_result = job.wait_for_completion()
 
-            self.assertEqual(op_result, exp_op_result)
+            assert op_result == exp_op_result
 
     def test_wait_complete3_success_result(self):
         """Test wait_for_completion() with successful complete job with a
@@ -538,7 +638,7 @@ class JobTests(unittest.TestCase):
 
             op_result = job.wait_for_completion()
 
-            self.assertEqual(op_result, exp_op_result)
+            assert op_result == exp_op_result
 
     def test_wait_complete3_timeout(self):
         """Test wait_for_completion() with timeout."""
@@ -577,8 +677,7 @@ class JobTests(unittest.TestCase):
                           "timeout: %s s" % (duration, operation_timeout))
             except OperationTimeout as exc:
                 msg = exc.args[0]
-                self.assertTrue(msg.startswith(
-                    "Waiting for completion of job"))
+                assert msg.startswith("Waiting for completion of job")
 
 
 def result_running_callback(request, context):
@@ -601,7 +700,3 @@ def result_complete_callback(request, context):
     }
     time.sleep(1)
     return json.dumps(job_result_complete)
-
-
-if __name__ == '__main__':
-    unittest.main()
diff --git a/tests/unit/test_timestats.py b/tests/unit/test_timestats.py
old mode 100755
new mode 100644
index abbc74e..284540a
--- a/tests/unit/test_timestats.py
+++ b/tests/unit/test_timestats.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # Copyright 2016-2017 IBM Corp. All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,7 +19,7 @@ Tests for time statistics (`_timestats` module).
 from __future__ import absolute_import, print_function
 
 import time
-import unittest
+import pytest
 
 from zhmcclient import TimeStatsKeeper, TimeStats
 
@@ -56,7 +55,7 @@ def measure(stats, duration):
     return end - begin
 
 
-class TimeStatsTests(unittest.TestCase):
+class TestTimeStats(object):
     """All tests for TimeStatsKeeper and TimeStats."""
 
     def test_enabling(self):
@@ -64,70 +63,67 @@ class TimeStatsTests(unittest.TestCase):
 
         keeper = TimeStatsKeeper()
 
-        self.assertFalse(keeper.enabled,
-                         "Verify that initial state is disabled")
+        assert not keeper.enabled, \
+            "Verify that initial state is disabled"
 
         keeper.disable()
-        self.assertFalse(keeper.enabled,
-                         "Verify that disabling a disabled keeper works")
+        assert not keeper.enabled, \
+            "Verify that disabling a disabled keeper works"
 
         keeper.enable()
-        self.assertTrue(keeper.enabled,
-                        "Verify that enabling a disabled keeper works")
+        assert keeper.enabled, \
+            "Verify that enabling a disabled keeper works"
 
         keeper.enable()
-        self.assertTrue(keeper.enabled,
-                        "Verify that enabling an enabled keeper works")
+        assert keeper.enabled, \
+            "Verify that enabling an enabled keeper works"
 
         keeper.disable()
-        self.assertFalse(keeper.enabled,
-                         "Verify that disabling an enabled keeper works")
+        assert not keeper.enabled, \
+            "Verify that disabling an enabled keeper works"
 
     def test_get(self):
         """Test getting time statistics."""
 
         keeper = TimeStatsKeeper()
         snapshot_length = len(keeper.snapshot())
-        self.assertEqual(snapshot_length, 0,
-                         "Verify that initial state has no time statistics. "
-                         "Actual number = %d" % snapshot_length)
+        assert snapshot_length == 0, \
+            "Verify that initial state has no time statistics. " \
+            "Actual number = %d" % snapshot_length
 
         stats = keeper.get_stats('foo')
         snapshot_length = len(keeper.snapshot())
-        self.assertEqual(snapshot_length, 0,
-                         "Verify that getting a new stats with a disabled "
-                         "keeper results in no time statistics. "
-                         "Actual number = %d" % snapshot_length)
-        self.assertEqual(stats.keeper, keeper)
-        self.assertEqual(stats.name, "disabled")  # stats for disabled keeper
-        self.assertEqual(stats.count, 0)
-        self.assertEqual(stats.avg_time, 0)
-        self.assertEqual(stats.min_time, float('inf'))
-        self.assertEqual(stats.max_time, 0)
+        assert snapshot_length == 0, \
+            "Verify that getting a new stats with a disabled keeper results " \
+            "in no time statistics. Actual number = %d" % snapshot_length
+        assert stats.keeper == keeper
+        assert stats.name == "disabled"  # stats for disabled keeper
+        assert stats.count == 0
+        assert stats.avg_time == 0
+        assert stats.min_time == float('inf')
+        assert stats.max_time == 0
 
         keeper.enable()
 
         stats = keeper.get_stats('foo')
         snapshot_length = len(keeper.snapshot())
-        self.assertEqual(snapshot_length, 1,
-                         "Verify that getting a new stats with an enabled "
-                         "keeper results in one time statistics. "
-                         "Actual number = %d" % snapshot_length)
-
-        self.assertEqual(stats.keeper, keeper)
-        self.assertEqual(stats.name, 'foo')
-        self.assertEqual(stats.count, 0)
-        self.assertEqual(stats.avg_time, 0)
-        self.assertEqual(stats.min_time, float('inf'))
-        self.assertEqual(stats.max_time, 0)
+        assert snapshot_length == 1, \
+            "Verify that getting a new stats with an enabled keeper results " \
+            "in one time statistics. Actual number = %d" % snapshot_length
+
+        assert stats.keeper == keeper
+        assert stats.name == 'foo'
+        assert stats.count == 0
+        assert stats.avg_time == 0
+        assert stats.min_time == float('inf')
+        assert stats.max_time == 0
 
         keeper.get_stats('foo')
         snapshot_length = len(keeper.snapshot())
-        self.assertEqual(snapshot_length, 1,
-                         "Verify that getting an existing stats with an "
-                         "enabled keeper results in the same number of time "
-                         "statistics. "
-                         "Actual number = %d" % snapshot_length)
+        assert snapshot_length == 1, \
+            "Verify that getting an existing stats with an enabled keeper " \
+            "results in the same number of time statistics. " \
+            "Actual number = %d" % snapshot_length
 
     def test_measure_enabled(self):
         """Test measuring time with enabled keeper."""
@@ -145,22 +141,22 @@ class TimeStatsTests(unittest.TestCase):
         stats_dict = keeper.snapshot()
         for op_name in stats_dict:
             stats = stats_dict[op_name]
-            self.assertEqual(stats.count, 1)
-            self.assertLess(time_abs_delta(stats.avg_time, dur), delta,
-                            "avg time: actual: %f, expected: %f, delta: %f" %
-                            (stats.avg_time, dur, delta))
-            self.assertLess(time_abs_delta(stats.min_time, dur), delta,
-                            "min time: actual: %f, expected: %f, delta: %f" %
-                            (stats.min_time, dur, delta))
-            self.assertLess(time_abs_delta(stats.max_time, dur), delta,
-                            "max time: actual: %f, expected: %f, delta: %f" %
-                            (stats.max_time, dur, delta))
+            assert stats.count == 1
+            assert time_abs_delta(stats.avg_time, dur) < delta, \
+                "avg time: actual: %f, expected: %f, delta: %f" % \
+                (stats.avg_time, dur, delta)
+            assert time_abs_delta(stats.min_time, dur) < delta, \
+                "min time: actual: %f, expected: %f, delta: %f" % \
+                (stats.min_time, dur, delta)
+            assert time_abs_delta(stats.max_time, dur) < delta, \
+                "max time: actual: %f, expected: %f, delta: %f" % \
+                (stats.max_time, dur, delta)
 
         stats.reset()
-        self.assertEqual(stats.count, 0)
-        self.assertEqual(stats.avg_time, 0)
-        self.assertEqual(stats.min_time, float('inf'))
-        self.assertEqual(stats.max_time, 0)
+        assert stats.count == 0
+        assert stats.avg_time == 0
+        assert stats.min_time == float('inf')
+        assert stats.max_time == 0
 
     def test_measure_disabled(self):
         """Test measuring time with disabled keeper."""
@@ -170,7 +166,7 @@ class TimeStatsTests(unittest.TestCase):
         duration = 0.2
 
         stats = keeper.get_stats('foo')
-        self.assertEqual(stats.name, 'disabled')
+        assert stats.name == 'disabled'
 
         stats.begin()
         time.sleep(duration)
@@ -179,10 +175,10 @@ class TimeStatsTests(unittest.TestCase):
         stats_dict = keeper.snapshot()
         for op_name in stats_dict:
             stats = stats_dict[op_name]
-            self.assertEqual(stats.count, 0)
-            self.assertEqual(stats.avg_time, 0)
-            self.assertEqual(stats.min_time, float('inf'))
-            self.assertEqual(stats.max_time, 0)
+            assert stats.count == 0
+            assert stats.avg_time == 0
+            assert stats.min_time == float('inf')
+            assert stats.max_time == 0
 
     def test_snapshot(self):
         """Test that snapshot() takes a stable snapshot."""
@@ -210,10 +206,10 @@ class TimeStatsTests(unittest.TestCase):
         # verify that only the first data item is in the snapshot
         for op_name in snap_stats_dict:
             snap_stats = snap_stats_dict[op_name]
-            self.assertEqual(snap_stats.count, 1)
+            assert snap_stats.count == 1
 
         # verify that both data items are in the original stats object
-        self.assertEqual(stats.count, 2)
+        assert stats.count == 2
 
     def test_measure_avg_min_max(self):
         """Test measuring avg min max values."""
@@ -238,16 +234,16 @@ class TimeStatsTests(unittest.TestCase):
         stats_dict = keeper.snapshot()
         for op_name in stats_dict:
             stats = stats_dict[op_name]
-            self.assertEqual(stats.count, 3)
-            self.assertLess(time_abs_delta(stats.avg_time, avg_dur), delta,
-                            "avg time: actual: %f, expected: %f, delta: %f" %
-                            (stats.avg_time, avg_dur, delta))
-            self.assertLess(time_abs_delta(stats.min_time, min_dur), delta,
-                            "min time: actual: %f, expected: %f, delta: %f" %
-                            (stats.min_time, min_dur, delta))
-            self.assertLess(time_abs_delta(stats.max_time, max_dur), delta,
-                            "max time: actual: %f, expected: %f, delta: %f" %
-                            (stats.max_time, max_dur, delta))
+            assert stats.count == 3
+            assert time_abs_delta(stats.avg_time, avg_dur) < delta, \
+                "avg time: actual: %f, expected: %f, delta: %f" % \
+                (stats.avg_time, avg_dur, delta)
+            assert time_abs_delta(stats.min_time, min_dur) < delta, \
+                "min time: actual: %f, expected: %f, delta: %f" % \
+                (stats.min_time, min_dur, delta)
+            assert time_abs_delta(stats.max_time, max_dur) < delta, \
+                "max time: actual: %f, expected: %f, delta: %f" % \
+                (stats.max_time, max_dur, delta)
 
     def test_only_end(self):
         """Test that invoking end() before begin() has ever been called raises
@@ -257,7 +253,7 @@ class TimeStatsTests(unittest.TestCase):
         keeper.enable()
         stats = keeper.get_stats('foo')
 
-        with self.assertRaises(RuntimeError):
+        with pytest.raises(RuntimeError):
             stats.end()
 
     def test_end_after_end(self):
@@ -272,7 +268,7 @@ class TimeStatsTests(unittest.TestCase):
         time.sleep(0.01)
         stats.end()
 
-        with self.assertRaises(RuntimeError):
+        with pytest.raises(RuntimeError):
             stats.end()
 
     def test_str_empty(self):
@@ -281,14 +277,14 @@ class TimeStatsTests(unittest.TestCase):
         keeper = TimeStatsKeeper()
         keeper.enable()
         s = str(keeper)
-        self.assertEqual(s, PRINT_HEADER)
+        assert s == PRINT_HEADER
 
     def test_str_disabled(self):
         """Test TimestatsKeeper.__str__() for a disabled keeper."""
 
         keeper = TimeStatsKeeper()
         s = str(keeper)
-        self.assertEqual(s, PRINT_HEADER_DISABLED)
+        assert s == PRINT_HEADER_DISABLED
 
     def test_str_one(self):
         """Test TimestatsKeeper.__str__() for an enabled keeper with one data
@@ -307,11 +303,11 @@ class TimeStatsTests(unittest.TestCase):
         stats.end()
 
         s = str(keeper)
-        self.assertTrue(s.startswith(PRINT_HEADER),
-                        "Unexpected str(keeper): %r" % s)
+        assert s.startswith(PRINT_HEADER), \
+            "Unexpected str(keeper): %r" % s
         num_lines = len(s.split('\n'))
-        self.assertEqual(num_lines, 3,
-                         "Unexpected str(keeper): %r" % s)
+        assert num_lines == 3, \
+            "Unexpected str(keeper): %r" % s
 
     def test_ts_str(self):
         """Test Timestats.__str__()."""
@@ -320,12 +316,8 @@ class TimeStatsTests(unittest.TestCase):
         timestats = TimeStats(keeper, "foo")
 
         s = str(timestats)
-        self.assertTrue(s.startswith("TimeStats:"),
-                        "Unexpected str(timestats): %r" % s)
+        assert s.startswith("TimeStats:"), \
+            "Unexpected str(timestats): %r" % s
         num_lines = len(s.split('\n'))
-        self.assertEqual(num_lines, 1,
-                         "Unexpected str(timestats): %r" % s)
-
-
-if __name__ == '__main__':
-    unittest.main()
+        assert num_lines == 1, \
+            "Unexpected str(timestats): %r" % s
diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py
index b30173c..79de959 100644
--- a/tests/unit/test_utils.py
+++ b/tests/unit/test_utils.py
@@ -162,7 +162,7 @@ class TestPythonDatetime(object):
         st = time.gmtime(0)
         assert st == epoch_st
 
-    def test_print_gmtime_max(self):
+    def x_test_print_gmtime_max(self):
         """Print the maximum for time.gmtime()."""
         max_ts = find_max_value(time.gmtime, 1)
         max_st = time.gmtime(max_ts)
@@ -170,7 +170,7 @@ class TestPythonDatetime(object):
               format(max_ts, max_st))
         sys.stdout.flush()
 
-    def test_print_fromtimestamp_max(self):
+    def x_test_print_fromtimestamp_max(self):
         """Print the maximum for datetime.fromtimestamp(utc)."""
 
         def datetime_fromtimestamp_utc(ts):
@@ -183,7 +183,7 @@ class TestPythonDatetime(object):
               format(max_ts, max_dt))
         sys.stdout.flush()
 
-    def test_print_datetime_max(self):
+    def x_test_print_datetime_max(self):
         """Print datetime.max."""
         print("\nMax value for Python datetime (datetime.max): {!r}".
               format(datetime.max))
@@ -233,7 +233,7 @@ class TestDatetimeFromTimestamp(object):
         # Verify the result
         assert isinstance(exc_info.value, exc_type)
 
-    def test_print_max_datetime_from_timestamp(self):
+    def x_test_print_max_datetime_from_timestamp(self):
         """Print the maximum for datetime_from_timestamp()."""
         max_ts = find_max_value(datetime_from_timestamp, 1)
         max_dt = datetime_from_timestamp(max_ts)
diff --git a/tests/unit/test_virtual_function.py b/tests/unit/test_virtual_function.py
old mode 100755
new mode 100644
index a4606e0..0d5f3b1
--- a/tests/unit/test_virtual_function.py
+++ b/tests/unit/test_virtual_function.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # Copyright 2016-2017 IBM Corp. All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,18 +18,18 @@ Unit tests for _virtual_function module.
 
 from __future__ import absolute_import, print_function
 
-import unittest
+# FIXME: Migrate requests_mock to zhmcclient_mock.
 import requests_mock
 
 from zhmcclient import Session, Client, VirtualFunction
 
 
-class VirtualFunctionTests(unittest.TestCase):
+class TestVirtualFunction(object):
     """
     All tests for VirtualFunction and VirtualFunctionManager classes.
     """
 
-    def setUp(self):
+    def setup_method(self):
         self.session = Session('test-dpm-host', 'test-user', 'test-id')
         self.client = Client(self.session)
         with requests_mock.mock() as m:
@@ -108,7 +107,7 @@ class VirtualFunctionTests(unittest.TestCase):
             partitions = partition_mgr.list(full_properties=True)
             self.partition = partitions[0]
 
-    def tearDown(self):
+    def teardown_method(self):
         with requests_mock.mock() as m:
             m.delete('/api/sessions/this-session', status_code=204)
             self.session.logoff()
@@ -116,7 +115,7 @@ class VirtualFunctionTests(unittest.TestCase):
     def test_init(self):
         """Test __init__() on VirtualFunctionManager instance in Partition."""
         vf_mgr = self.partition.virtual_functions
-        self.assertEqual(vf_mgr.partition, self.partition)
+        assert vf_mgr.partition == self.partition
 
     def test_list_short_ok(self):
         """
@@ -126,18 +125,15 @@ class VirtualFunctionTests(unittest.TestCase):
         vf_mgr = self.partition.virtual_functions
         vfs = vf_mgr.list(full_properties=False)
 
-        self.assertEqual(
-            len(vfs),
-            len(self.partition.properties['virtual-function-uris']))
+        assert len(vfs) == \
+            len(self.partition.properties['virtual-function-uris'])
         for idx, vf in enumerate(vfs):
-            self.assertEqual(
-                vf.properties['element-uri'],
-                self.partition.properties['virtual-function-uris'][idx])
-            self.assertEqual(
-                vf.uri,
-                self.partition.properties['virtual-function-uris'][idx])
-            self.assertFalse(vf.full_properties)
-            self.assertEqual(vf.manager, vf_mgr)
+            assert vf.properties['element-uri'] == \
+                self.partition.properties['virtual-function-uris'][idx]
+            assert vf.uri == \
+                self.partition.properties['virtual-function-uris'][idx]
+            assert not vf.full_properties
+            assert vf.manager == vf_mgr
 
     def test_list_full_ok(self):
         """
@@ -179,18 +175,15 @@ class VirtualFunctionTests(unittest.TestCase):
 
             vfs = vf_mgr.list(full_properties=True)
 
-            self.assertEqual(
-                len(vfs),
-                len(self.partition.properties['virtual-function-uris']))
+            assert len(vfs) == \
+                len(self.partition.properties['virtual-function-uris'])
             for idx, vf in enumerate(vfs):
-                self.assertEqual(
-                    vf.properties['element-uri'],
-                    self.partition.properties['virtual-function-uris'][idx])
-                self.assertEqual(
-                    vf.uri,
-                    self.partition.properties['virtual-function-uris'][idx])
-                self.assertTrue(vf.full_properties)
-                self.assertEqual(vf.manager, vf_mgr)
+                assert vf.properties['element-uri'] == \
+                    self.partition.properties['virtual-function-uris'][idx]
+                assert vf.uri == \
+                    self.partition.properties['virtual-function-uris'][idx]
+                assert vf.full_properties
+                assert vf.manager == vf_mgr
 
     def test_list_filter_name_ok(self):
         """
@@ -233,16 +226,15 @@ class VirtualFunctionTests(unittest.TestCase):
             filter_args = {'name': 'vf2'}
             vfs = vf_mgr.list(filter_args=filter_args)
 
-            self.assertEqual(len(vfs), 1)
+            assert len(vfs) == 1
             vf = vfs[0]
-            self.assertEqual(vf.name, 'vf2')
-            self.assertEqual(
-                vf.uri,
-                '/api/partitions/fake-part-id-1/virtual-functions/'
-                'fake-vf-id-2')
-            self.assertEqual(vf.properties['name'], 'vf2')
-            self.assertEqual(vf.properties['element-id'], 'fake-vf-id-2')
-            self.assertEqual(vf.manager, vf_mgr)
+            assert vf.name == 'vf2'
+            assert vf.uri == \
+                '/api/partitions/fake-part-id-1/virtual-functions/' \
+                'fake-vf-id-2'
+            assert vf.properties['name'] == 'vf2'
+            assert vf.properties['element-id'] == 'fake-vf-id-2'
+            assert vf.manager == vf_mgr
 
     def test_list_filter_elementid_ok(self):
         """
@@ -285,16 +277,15 @@ class VirtualFunctionTests(unittest.TestCase):
             filter_args = {'element-id': 'fake-vf-id-2'}
             vfs = vf_mgr.list(filter_args=filter_args)
 
-            self.assertEqual(len(vfs), 1)
+            assert len(vfs) == 1
             vf = vfs[0]
-            self.assertEqual(vf.name, 'vf2')
-            self.assertEqual(
-                vf.uri,
-                '/api/partitions/fake-part-id-1/virtual-functions/'
-                'fake-vf-id-2')
-            self.assertEqual(vf.properties['name'], 'vf2')
-            self.assertEqual(vf.properties['element-id'], 'fake-vf-id-2')
-            self.assertEqual(vf.manager, vf_mgr)
+            assert vf.name == 'vf2'
+            assert vf.uri == \
+                '/api/partitions/fake-part-id-1/virtual-functions/' \
+                'fake-vf-id-2'
+            assert vf.properties['name'] == 'vf2'
+            assert vf.properties['element-id'] == 'fake-vf-id-2'
+            assert vf.manager == vf_mgr
 
     def test_create(self):
         """
@@ -312,9 +303,9 @@ class VirtualFunctionTests(unittest.TestCase):
 
             vf = vf_mgr.create(properties={})
 
-            self.assertTrue(isinstance(vf, VirtualFunction))
-            self.assertEqual(vf.properties, result)
-            self.assertEqual(vf.uri, result['element-uri'])
+            assert isinstance(vf, VirtualFunction)
+            assert vf.properties == result
+            assert vf.uri == result['element-uri']
 
     def test_delete(self):
         """
@@ -339,7 +330,3 @@ class VirtualFunctionTests(unittest.TestCase):
             m.post('/api/partitions/fake-part-id-1/virtual-functions/'
                    'fake-vf-id-1', status_code=204)
             vf.update_properties(properties={})
-
-
-if __name__ == '__main__':
-    unittest.main()
diff --git a/tests/unit/test_virtual_switch.py b/tests/unit/test_virtual_switch.py
old mode 100755
new mode 100644
index 971cb83..c39ba91
--- a/tests/unit/test_virtual_switch.py
+++ b/tests/unit/test_virtual_switch.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # Copyright 2016-2017 IBM Corp. All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,17 +18,17 @@ Unit tests for _virtual_switch module.
 
 from __future__ import absolute_import, print_function
 
-import unittest
 import re
+# FIXME: Migrate requests_mock to zhmcclient_mock.
 import requests_mock
 
 from zhmcclient import Session, Client, Nic
 
 
-class VirtualSwitchTests(unittest.TestCase):
+class TestVirtualSwitch(object):
     """All tests for VirtualSwitch and VirtualSwitchManager classes."""
 
-    def setUp(self):
+    def setup_method(self):
         self.session = Session('vswitch-dpm-host', 'vswitch-user',
                                'vswitch-pwd')
         self.client = Client(self.session)
@@ -55,7 +54,7 @@ class VirtualSwitchTests(unittest.TestCase):
             cpcs = self.cpc_mgr.list()
             self.cpc = cpcs[0]
 
-    def tearDown(self):
+    def teardown_method(self):
         with requests_mock.mock() as m:
             m.delete('/api/sessions/this-session', status_code=204)
             self.session.logoff()
@@ -63,7 +62,7 @@ class VirtualSwitchTests(unittest.TestCase):
     def test_init(self):
         """Test __init__() on VirtualSwitchManager instance in CPC."""
         vswitch_mgr = self.cpc.virtual_switches
-        self.assertEqual(vswitch_mgr.cpc, self.cpc)
+        assert vswitch_mgr.cpc == self.cpc
 
     def test_list_short_ok(self):
         """
@@ -91,16 +90,14 @@ class VirtualSwitchTests(unittest.TestCase):
 
             vswitches = vswitch_mgr.list(full_properties=False)
 
-            self.assertEqual(len(vswitches), len(result['virtual-switches']))
+            assert len(vswitches) == len(result['virtual-switches'])
             for idx, vswitch in enumerate(vswitches):
-                self.assertEqual(
-                    vswitch.properties,
-                    result['virtual-switches'][idx])
-                self.assertEqual(
-                    vswitch.uri,
-                    result['virtual-switches'][idx]['object-uri'])
-                self.assertFalse(vswitch.full_properties)
-                self.assertEqual(vswitch.manager, vswitch_mgr)
+                assert vswitch.properties == \
+                    result['virtual-switches'][idx]
+                assert vswitch.uri == \
+                    result['virtual-switches'][idx]['object-uri']
+                assert not vswitch.full_properties
+                assert vswitch.manager == vswitch_mgr
 
     def test_list_full_ok(self):
         """
@@ -149,15 +146,14 @@ class VirtualSwitchTests(unittest.TestCase):
 
             vswitches = vswitch_mgr.list(full_properties=True)
 
-            self.assertEqual(len(vswitches), len(result['virtual-switches']))
+            assert len(vswitches) == len(result['virtual-switches'])
             for idx, vswitch in enumerate(vswitches):
-                self.assertEqual(vswitch.properties['name'],
-                                 result['virtual-switches'][idx]['name'])
-                self.assertEqual(
-                    vswitch.uri,
-                    result['virtual-switches'][idx]['object-uri'])
-                self.assertTrue(vswitch.full_properties)
-                self.assertEqual(vswitch.manager, vswitch_mgr)
+                assert vswitch.properties['name'] == \
+                    result['virtual-switches'][idx]['name']
+                assert vswitch.uri == \
+                    result['virtual-switches'][idx]['object-uri']
+                assert vswitch.full_properties
+                assert vswitch.manager == vswitch_mgr
 
     def test_update_properties(self):
         """
@@ -225,17 +221,13 @@ class VirtualSwitchTests(unittest.TestCase):
 
             nics = vswitch.get_connected_nics()
 
-            self.assertTrue(isinstance(nics, list))
+            assert isinstance(nics, list)
             for i, nic in enumerate(nics):
-                self.assertTrue(isinstance(nic, Nic))
+                assert isinstance(nic, Nic)
                 nic_uri = result['connected-vnic-uris'][i]
-                self.assertEqual(nic.uri, nic_uri)
-                self.assertEqual(nic.properties['element-uri'], nic_uri)
+                assert nic.uri == nic_uri
+                assert nic.properties['element-uri'] == nic_uri
                 m = re.match(r"^/api/partitions/([^/]+)/nics/([^/]+)/?$",
                              nic_uri)
                 nic_id = m.group(2)
-                self.assertEqual(nic.properties['element-id'], nic_id)
-
-
-if __name__ == '__main__':
-    unittest.main()
+                assert nic.properties['element-id'] == nic_id
diff --git a/tests/unit/zhmcclient_mock/test_example.py b/tests/unit/zhmcclient_mock/test_example.py
old mode 100755
new mode 100644
index 92f695e..7324a21
--- a/tests/unit/zhmcclient_mock/test_example.py
+++ b/tests/unit/zhmcclient_mock/test_example.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # Copyright 2016-2017 IBM Corp. All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,12 +19,14 @@ Example unit test for a user of the zhmcclient package.
 from __future__ import absolute_import, print_function
 
 import requests.packages.urllib3
-import unittest
+
 import zhmcclient
 import zhmcclient_mock
 
+requests.packages.urllib3.disable_warnings()
+
 
-class MyTests(unittest.TestCase):
+class TestMy(object):
 
     @staticmethod
     def create_session_1():
@@ -153,40 +154,40 @@ class MyTests(unittest.TestCase):
         Check the faked session and its faked HMC.
         """
 
-        self.assertEqual(self.session.host, 'fake-host')
+        assert self.session.host == 'fake-host'
 
-        self.assertEqual(self.client.version_info(), (1, 8))
+        assert self.client.version_info() == (1, 8)
 
         cpcs = self.client.cpcs.list()
-        self.assertEqual(len(cpcs), 2)
+        assert len(cpcs) == 2
 
         cpc1 = cpcs[0]  # a CPC in classic mode
-        self.assertEqual(cpc1.get_property('name'), 'cpc_1')
-        self.assertFalse(cpc1.dpm_enabled)
+        assert cpc1.get_property('name') == 'cpc_1'
+        assert not cpc1.dpm_enabled
 
         lpars = cpc1.lpars.list()
-        self.assertEqual(len(lpars), 1)
+        assert len(lpars) == 1
         lpar1 = lpars[0]
-        self.assertEqual(lpar1.get_property('name'), 'lpar_1')
+        assert lpar1.get_property('name') == 'lpar_1'
 
         cpc2 = cpcs[1]  # a CPC in DPM mode
-        self.assertEqual(cpc2.get_property('name'), 'cpc_2')
-        self.assertTrue(cpc2.dpm_enabled)
+        assert cpc2.get_property('name') == 'cpc_2'
+        assert cpc2.dpm_enabled
 
         partitions = cpc2.partitions.list()
-        self.assertEqual(len(partitions), 1)
+        assert len(partitions) == 1
         partition1 = partitions[0]
-        self.assertEqual(partition1.get_property('name'), 'partition_1')
+        assert partition1.get_property('name') == 'partition_1'
 
         adapters = cpc2.adapters.list()
-        self.assertEqual(len(adapters), 1)
+        assert len(adapters) == 1
         adapter1 = adapters[0]
-        self.assertEqual(adapter1.get_property('name'), 'osa_1')
+        assert adapter1.get_property('name') == 'osa_1'
 
         ports = adapter1.ports.list()
-        self.assertEqual(len(ports), 1)
+        assert len(ports) == 1
         port1 = ports[0]
-        self.assertEqual(port1.get_property('name'), 'osa_1_port_1')
+        assert port1.get_property('name') == 'osa_1_port_1'
 
     def test_session_1(self):
         self.session = self.create_session_1()
@@ -197,8 +198,3 @@ class MyTests(unittest.TestCase):
         self.session = self.create_session_2()
         self.client = zhmcclient.Client(self.session)
         self.check()
-
-
-if __name__ == '__main__':
-    requests.packages.urllib3.disable_warnings()
-    unittest.main()
diff --git a/tests/unit/zhmcclient_mock/test_hmc.py b/tests/unit/zhmcclient_mock/test_hmc.py
old mode 100755
new mode 100644
index dcba1f0..7499a04
--- a/tests/unit/zhmcclient_mock/test_hmc.py
+++ b/tests/unit/zhmcclient_mock/test_hmc.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # Copyright 2016-2017 IBM Corp. All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,8 +18,9 @@ Unit tests for _hmc module of the zhmcclient_mock package.
 
 from __future__ import absolute_import, print_function
 
-import unittest
+import re
 from datetime import datetime
+import pytest
 
 from zhmcclient_mock._hmc import FakedHmc, \
     FakedBaseManager, FakedBaseResource, \
@@ -38,10 +38,10 @@ from zhmcclient_mock._hmc import FakedHmc, \
     FakedMetricGroupDefinition, FakedMetricObjectValues
 
 
-class FakedHmcTests(unittest.TestCase):
+class TestFakedHmc(object):
     """All tests for the zhmcclient_mock.FakedHmc class."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc = FakedHmc('fake-hmc', '2.13.1', '1.8')
 
     def test_repr(self):
@@ -52,22 +52,20 @@ class FakedHmcTests(unittest.TestCase):
 
         repr_str = repr_str.replace('\n', '\\n')
         # We check just the begin of the string:
-        self.assertRegexpMatches(
-            repr_str,
-            r'^{classname}\s+at\s+0x{id:08x}\s+\(\\n.*'.format(
-                classname=hmc.__class__.__name__,
-                id=id(hmc)))
+        assert re.match(r'^{classname}\s+at\s+0x{id:08x}\s+\(\\n.*'.
+                        format(classname=hmc.__class__.__name__, id=id(hmc)),
+                        repr_str)
 
     def test_hmc(self):
-        self.assertEqual(self.hmc.hmc_name, 'fake-hmc')
-        self.assertEqual(self.hmc.hmc_version, '2.13.1')
-        self.assertEqual(self.hmc.api_version, '1.8')
-        self.assertIsInstance(self.hmc.cpcs, FakedCpcManager)
+        assert self.hmc.hmc_name == 'fake-hmc'
+        assert self.hmc.hmc_version == '2.13.1'
+        assert self.hmc.api_version == '1.8'
+        assert isinstance(self.hmc.cpcs, FakedCpcManager)
 
         # the function to be tested:
         cpcs = self.hmc.cpcs.list()
 
-        self.assertEqual(len(cpcs), 0)
+        assert len(cpcs) == 0
 
     def test_hmc_1_cpc(self):
         cpc1_in_props = {'name': 'cpc1'}
@@ -87,12 +85,12 @@ class FakedHmcTests(unittest.TestCase):
         # the function to be tested:
         cpcs = self.hmc.cpcs.list()
 
-        self.assertEqual(len(cpcs), 1)
-        self.assertEqual(cpcs[0], cpc1)
+        assert len(cpcs) == 1
+        assert cpcs[0] == cpc1
 
-        self.assertIsInstance(cpc1, FakedCpc)
-        self.assertEqual(cpc1.properties, cpc1_out_props)
-        self.assertEqual(cpc1.manager, self.hmc.cpcs)
+        assert isinstance(cpc1, FakedCpc)
+        assert cpc1.properties == cpc1_out_props
+        assert cpc1.manager == self.hmc.cpcs
 
     def test_hmc_2_cpcs(self):
         cpc1_in_props = {'name': 'cpc1'}
@@ -126,18 +124,18 @@ class FakedHmcTests(unittest.TestCase):
         # the function to be tested:
         cpcs = self.hmc.cpcs.list()
 
-        self.assertEqual(len(cpcs), 2)
+        assert len(cpcs) == 2
         # We expect the order of addition to be maintained:
-        self.assertEqual(cpcs[0], cpc1)
-        self.assertEqual(cpcs[1], cpc2)
+        assert cpcs[0] == cpc1
+        assert cpcs[1] == cpc2
 
-        self.assertIsInstance(cpc1, FakedCpc)
-        self.assertEqual(cpc1.properties, cpc1_out_props)
-        self.assertEqual(cpc1.manager, self.hmc.cpcs)
+        assert isinstance(cpc1, FakedCpc)
+        assert cpc1.properties == cpc1_out_props
+        assert cpc1.manager == self.hmc.cpcs
 
-        self.assertIsInstance(cpc2, FakedCpc)
-        self.assertEqual(cpc2.properties, cpc2_out_props)
-        self.assertEqual(cpc2.manager, self.hmc.cpcs)
+        assert isinstance(cpc2, FakedCpc)
+        assert cpc2.properties == cpc2_out_props
+        assert cpc2.manager == self.hmc.cpcs
 
     def test_res_dict(self):
         cpc1_in_props = {'name': 'cpc1'}
@@ -165,7 +163,7 @@ class FakedHmcTests(unittest.TestCase):
 
         cpcs = self.hmc.cpcs.list()
 
-        self.assertEqual(len(cpcs), 1)
+        assert len(cpcs) == 1
 
         cpc1 = cpcs[0]
         cpc1_out_props = cpc1_in_props.copy()
@@ -176,18 +174,18 @@ class FakedHmcTests(unittest.TestCase):
             'is-ensemble-member': False,
             'status': 'operating',
         })
-        self.assertIsInstance(cpc1, FakedCpc)
-        self.assertEqual(cpc1.properties, cpc1_out_props)
-        self.assertEqual(cpc1.manager, self.hmc.cpcs)
+        assert isinstance(cpc1, FakedCpc)
+        assert cpc1.properties == cpc1_out_props
+        assert cpc1.manager == self.hmc.cpcs
 
         cpc1_adapters = cpc1.adapters.list()
 
-        self.assertEqual(len(cpc1_adapters), 1)
+        assert len(cpc1_adapters) == 1
         adapter1 = cpc1_adapters[0]
 
         adapter1_ports = adapter1.ports.list()
 
-        self.assertEqual(len(adapter1_ports), 1)
+        assert len(adapter1_ports) == 1
         port1 = adapter1_ports[0]
 
         adapter1_out_props = adapter1_in_props.copy()
@@ -197,24 +195,24 @@ class FakedHmcTests(unittest.TestCase):
             'status': 'active',
             'network-port-uris': [port1.uri],
         })
-        self.assertIsInstance(adapter1, FakedAdapter)
-        self.assertEqual(adapter1.properties, adapter1_out_props)
-        self.assertEqual(adapter1.manager, cpc1.adapters)
+        assert isinstance(adapter1, FakedAdapter)
+        assert adapter1.properties == adapter1_out_props
+        assert adapter1.manager == cpc1.adapters
 
         port1_out_props = port1_in_props.copy()
         port1_out_props.update({
             'element-id': port1.oid,
             'element-uri': port1.uri,
         })
-        self.assertIsInstance(port1, FakedPort)
-        self.assertEqual(port1.properties, port1_out_props)
-        self.assertEqual(port1.manager, adapter1.ports)
+        assert isinstance(port1, FakedPort)
+        assert port1.properties == port1_out_props
+        assert port1.manager == adapter1.ports
 
 
-class FakedBaseTests(unittest.TestCase):
+class TestFakedBase(object):
     """All tests for the FakedBaseManager and FakedBaseResource classes."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc = FakedHmc('fake-hmc', '2.13.1', '1.8')
 
         self.cpc1_oid = '42-abc-543'
@@ -250,11 +248,10 @@ class FakedBaseTests(unittest.TestCase):
 
         repr_str = repr_str.replace('\n', '\\n')
         # We check just the begin of the string:
-        self.assertRegexpMatches(
-            repr_str,
-            r'^{classname}\s+at\s+0x{id:08x}\s+\(\\n.*'.format(
-                classname=resource.__class__.__name__,
-                id=id(resource)))
+        assert re.match(r'^{classname}\s+at\s+0x{id:08x}\s+\(\\n.*'.
+                        format(classname=resource.__class__.__name__,
+                               id=id(resource)),
+                        repr_str)
 
     def test_manager_repr(self):
         """Test FakedBaseManager.__repr__()."""
@@ -264,42 +261,39 @@ class FakedBaseTests(unittest.TestCase):
 
         repr_str = repr_str.replace('\n', '\\n')
         # We check just the begin of the string:
-        self.assertRegexpMatches(
-            repr_str,
-            r'^{classname}\s+at\s+0x{id:08x}\s+\(\\n.*'.format(
-                classname=manager.__class__.__name__,
-                id=id(manager)))
+        assert re.match(r'^{classname}\s+at\s+0x{id:08x}\s+\(\\n.*'.
+                        format(classname=manager.__class__.__name__,
+                               id=id(manager)),
+                        repr_str)
 
     def test_manager_attr(self):
         """Test FakedBaseManager attributes."""
 
-        self.assertIsInstance(self.cpc_manager, FakedBaseManager)
+        assert isinstance(self.cpc_manager, FakedBaseManager)
 
-        self.assertEqual(self.cpc_manager.hmc, self.hmc)
-        self.assertEqual(self.cpc_manager.parent, self.hmc)
-        self.assertEqual(self.cpc_manager.resource_class, FakedCpc)
-        self.assertEqual(self.cpc_manager.base_uri, '/api/cpcs')
-        self.assertEqual(self.cpc_manager.oid_prop, 'object-id')
-        self.assertEqual(self.cpc_manager.uri_prop, 'object-uri')
+        assert self.cpc_manager.hmc == self.hmc
+        assert self.cpc_manager.parent == self.hmc
+        assert self.cpc_manager.resource_class == FakedCpc
+        assert self.cpc_manager.base_uri == '/api/cpcs'
+        assert self.cpc_manager.oid_prop == 'object-id'
+        assert self.cpc_manager.uri_prop == 'object-uri'
 
     def test_resource_attr(self):
         """Test FakedBaseResource attributes."""
 
-        self.assertIsInstance(self.cpc_resource, FakedBaseResource)
+        assert isinstance(self.cpc_resource, FakedBaseResource)
 
-        self.assertEqual(self.cpc_resource.manager, self.cpc_manager)
-        self.assertEqual(self.cpc_resource.properties, self.cpc1_out_props)
-        self.assertEqual(self.cpc_resource.oid,
-                         self.cpc1_out_props['object-id'])
-        self.assertEqual(self.cpc_resource.uri,
-                         self.cpc1_out_props['object-uri'])
+        assert self.cpc_resource.manager == self.cpc_manager
+        assert self.cpc_resource.properties == self.cpc1_out_props
+        assert self.cpc_resource.oid == self.cpc1_out_props['object-id']
+        assert self.cpc_resource.uri == self.cpc1_out_props['object-uri']
 
 
-class FakedActivationProfileTests(unittest.TestCase):
+class TestFakedActivationProfile(object):
     """All tests for the FakedActivationProfileManager and
     FakedActivationProfile classes."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc = FakedHmc('fake-hmc', '2.13.1', '1.8')
         self.cpc1_in_props = {'name': 'cpc1'}
         self.resetprofile1_in_props = {'name': 'resetprofile1'}
@@ -331,27 +325,27 @@ class FakedActivationProfileTests(unittest.TestCase):
 
         # Test reset activation profiles
 
-        self.assertIsInstance(cpc1.reset_activation_profiles,
-                              FakedActivationProfileManager)
-        self.assertEqual(cpc1.reset_activation_profiles.profile_type, 'reset')
-        self.assertRegexpMatches(cpc1.reset_activation_profiles.base_uri,
-                                 r'/api/cpcs/[^/]+/reset-activation-profiles')
+        assert isinstance(cpc1.reset_activation_profiles,
+                          FakedActivationProfileManager)
+        assert cpc1.reset_activation_profiles.profile_type == 'reset'
+        assert re.match(r'/api/cpcs/[^/]+/reset-activation-profiles',
+                        cpc1.reset_activation_profiles.base_uri)
 
         # Test image activation profiles
 
-        self.assertIsInstance(cpc1.image_activation_profiles,
-                              FakedActivationProfileManager)
-        self.assertEqual(cpc1.image_activation_profiles.profile_type, 'image')
-        self.assertRegexpMatches(cpc1.image_activation_profiles.base_uri,
-                                 r'/api/cpcs/[^/]+/image-activation-profiles')
+        assert isinstance(cpc1.image_activation_profiles,
+                          FakedActivationProfileManager)
+        assert cpc1.image_activation_profiles.profile_type == 'image'
+        assert re.match(r'/api/cpcs/[^/]+/image-activation-profiles',
+                        cpc1.image_activation_profiles.base_uri)
 
         # Test load activation profiles
 
-        self.assertIsInstance(cpc1.load_activation_profiles,
-                              FakedActivationProfileManager)
-        self.assertEqual(cpc1.load_activation_profiles.profile_type, 'load')
-        self.assertRegexpMatches(cpc1.load_activation_profiles.base_uri,
-                                 r'/api/cpcs/[^/]+/load-activation-profiles')
+        assert isinstance(cpc1.load_activation_profiles,
+                          FakedActivationProfileManager)
+        assert cpc1.load_activation_profiles.profile_type == 'load'
+        assert re.match(r'/api/cpcs/[^/]+/load-activation-profiles',
+                        cpc1.load_activation_profiles.base_uri)
 
     def test_profiles_list(self):
         """Test list() of FakedActivationProfileManager."""
@@ -362,53 +356,53 @@ class FakedActivationProfileTests(unittest.TestCase):
 
         resetprofiles = cpc1.reset_activation_profiles.list()
 
-        self.assertEqual(len(resetprofiles), 1)
+        assert len(resetprofiles) == 1
         resetprofile1 = resetprofiles[0]
         resetprofile1_out_props = self.resetprofile1_in_props.copy()
         resetprofile1_out_props.update({
             'name': resetprofile1.oid,
             'element-uri': resetprofile1.uri,
         })
-        self.assertIsInstance(resetprofile1, FakedActivationProfile)
-        self.assertEqual(resetprofile1.properties, resetprofile1_out_props)
-        self.assertEqual(resetprofile1.manager, cpc1.reset_activation_profiles)
+        assert isinstance(resetprofile1, FakedActivationProfile)
+        assert resetprofile1.properties == resetprofile1_out_props
+        assert resetprofile1.manager == cpc1.reset_activation_profiles
 
         # Test image activation profiles
 
         imageprofiles = cpc1.image_activation_profiles.list()
 
-        self.assertEqual(len(imageprofiles), 1)
+        assert len(imageprofiles) == 1
         imageprofile1 = imageprofiles[0]
         imageprofile1_out_props = self.imageprofile1_in_props.copy()
         imageprofile1_out_props.update({
             'name': imageprofile1.oid,
             'element-uri': imageprofile1.uri,
         })
-        self.assertIsInstance(imageprofile1, FakedActivationProfile)
-        self.assertEqual(imageprofile1.properties, imageprofile1_out_props)
-        self.assertEqual(imageprofile1.manager, cpc1.image_activation_profiles)
+        assert isinstance(imageprofile1, FakedActivationProfile)
+        assert imageprofile1.properties == imageprofile1_out_props
+        assert imageprofile1.manager == cpc1.image_activation_profiles
 
         # Test load activation profiles
 
         loadprofiles = cpc1.load_activation_profiles.list()
 
-        self.assertEqual(len(loadprofiles), 1)
+        assert len(loadprofiles) == 1
         loadprofile1 = loadprofiles[0]
         loadprofile1_out_props = self.loadprofile1_in_props.copy()
         loadprofile1_out_props.update({
             'name': loadprofile1.oid,
             'element-uri': loadprofile1.uri,
         })
-        self.assertIsInstance(loadprofile1, FakedActivationProfile)
-        self.assertEqual(loadprofile1.properties, loadprofile1_out_props)
-        self.assertEqual(loadprofile1.manager, cpc1.load_activation_profiles)
+        assert isinstance(loadprofile1, FakedActivationProfile)
+        assert loadprofile1.properties == loadprofile1_out_props
+        assert loadprofile1.manager == cpc1.load_activation_profiles
 
     def test_profiles_add(self):
         """Test add() of FakedActivationProfileManager."""
         cpcs = self.hmc.cpcs.list()
         cpc1 = cpcs[0]
         resetprofiles = cpc1.reset_activation_profiles.list()
-        self.assertEqual(len(resetprofiles), 1)
+        assert len(resetprofiles) == 1
 
         resetprofile2_in_props = {'name': 'resetprofile2'}
 
@@ -417,23 +411,23 @@ class FakedActivationProfileTests(unittest.TestCase):
             resetprofile2_in_props)
 
         resetprofiles = cpc1.reset_activation_profiles.list()
-        self.assertEqual(len(resetprofiles), 2)
+        assert len(resetprofiles) == 2
 
         resetprofile2 = [p for p in resetprofiles
                          if p.properties['name'] ==
                          resetprofile2_in_props['name']][0]
 
-        self.assertEqual(new_resetprofile.properties, resetprofile2.properties)
-        self.assertEqual(new_resetprofile.manager, resetprofile2.manager)
+        assert new_resetprofile.properties == resetprofile2.properties
+        assert new_resetprofile.manager == resetprofile2.manager
 
         resetprofile2_out_props = resetprofile2_in_props.copy()
         resetprofile2_out_props.update({
             'name': resetprofile2.oid,
             'element-uri': resetprofile2.uri,
         })
-        self.assertIsInstance(resetprofile2, FakedActivationProfile)
-        self.assertEqual(resetprofile2.properties, resetprofile2_out_props)
-        self.assertEqual(resetprofile2.manager, cpc1.reset_activation_profiles)
+        assert isinstance(resetprofile2, FakedActivationProfile)
+        assert resetprofile2.properties == resetprofile2_out_props
+        assert resetprofile2.manager == cpc1.reset_activation_profiles
 
         # Because we know that the image and load profile managers are of the
         # same class, we don't need to test them.
@@ -444,22 +438,22 @@ class FakedActivationProfileTests(unittest.TestCase):
         cpc1 = cpcs[0]
         resetprofiles = cpc1.reset_activation_profiles.list()
         resetprofile1 = resetprofiles[0]
-        self.assertEqual(len(resetprofiles), 1)
+        assert len(resetprofiles) == 1
 
         # the function to be tested:
         cpc1.reset_activation_profiles.remove(resetprofile1.oid)
 
         resetprofiles = cpc1.reset_activation_profiles.list()
-        self.assertEqual(len(resetprofiles), 0)
+        assert len(resetprofiles) == 0
 
         # Because we know that the image and load profile managers are of the
         # same class, we don't need to test them.
 
 
-class FakedAdapterTests(unittest.TestCase):
+class TestFakedAdapter(object):
     """All tests for the FakedAdapterManager and FakedAdapter classes."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc = FakedHmc('fake-hmc', '2.13.1', '1.8')
         self.cpc1_in_props = {'name': 'cpc1'}
         self.adapter1_in_props = {'name': 'adapter1', 'type': 'roce'}
@@ -487,19 +481,18 @@ class FakedAdapterTests(unittest.TestCase):
 
         repr_str = repr_str.replace('\n', '\\n')
         # We check just the begin of the string:
-        self.assertRegexpMatches(
-            repr_str,
-            r'^{classname}\s+at\s+0x{id:08x}\s+\(\\n.*'.format(
-                classname=adapter.__class__.__name__,
-                id=id(adapter)))
+        assert re.match(r'^{classname}\s+at\s+0x{id:08x}\s+\(\\n.*'.
+                        format(classname=adapter.__class__.__name__,
+                               id=id(adapter)),
+                        repr_str)
 
     def test_adapters_attr(self):
         """Test CPC 'adapters' attribute."""
         cpcs = self.hmc.cpcs.list()
         cpc1 = cpcs[0]
 
-        self.assertIsInstance(cpc1.adapters, FakedAdapterManager)
-        self.assertRegexpMatches(cpc1.adapters.base_uri, r'/api/adapters')
+        assert isinstance(cpc1.adapters, FakedAdapterManager)
+        assert re.match(r'/api/adapters', cpc1.adapters.base_uri)
 
     def test_adapters_list(self):
         """Test list() of FakedAdapterManager."""
@@ -509,7 +502,7 @@ class FakedAdapterTests(unittest.TestCase):
         # the function to be tested:
         adapters = cpc1.adapters.list()
 
-        self.assertEqual(len(adapters), 1)
+        assert len(adapters) == 1
         adapter1 = adapters[0]
         adapter1_out_props = self.adapter1_in_props.copy()
         adapter1_out_props.update({
@@ -519,19 +512,19 @@ class FakedAdapterTests(unittest.TestCase):
             'adapter-family': 'roce',
             'network-port-uris': [],
         })
-        self.assertIsInstance(adapter1, FakedAdapter)
-        self.assertEqual(adapter1.properties, adapter1_out_props)
-        self.assertEqual(adapter1.manager, cpc1.adapters)
+        assert isinstance(adapter1, FakedAdapter)
+        assert adapter1.properties == adapter1_out_props
+        assert adapter1.manager == cpc1.adapters
 
         # Quick check of child resources:
-        self.assertIsInstance(adapter1.ports, FakedPortManager)
+        assert isinstance(adapter1.ports, FakedPortManager)
 
     def test_adapters_add(self):
         """Test add() of FakedAdapterManager."""
         cpcs = self.hmc.cpcs.list()
         cpc1 = cpcs[0]
         adapters = cpc1.adapters.list()
-        self.assertEqual(len(adapters), 1)
+        assert len(adapters) == 1
 
         adapter2_in_props = {'name': 'adapter2', 'adapter-family': 'ficon'}
 
@@ -540,13 +533,13 @@ class FakedAdapterTests(unittest.TestCase):
             adapter2_in_props)
 
         adapters = cpc1.adapters.list()
-        self.assertEqual(len(adapters), 2)
+        assert len(adapters) == 2
 
         adapter2 = [a for a in adapters
                     if a.properties['name'] == adapter2_in_props['name']][0]
 
-        self.assertEqual(new_adapter.properties, adapter2.properties)
-        self.assertEqual(new_adapter.manager, adapter2.manager)
+        assert new_adapter.properties == adapter2.properties
+        assert new_adapter.manager == adapter2.manager
 
         adapter2_out_props = adapter2_in_props.copy()
         adapter2_out_props.update({
@@ -555,9 +548,9 @@ class FakedAdapterTests(unittest.TestCase):
             'status': 'active',
             'storage-port-uris': [],
         })
-        self.assertIsInstance(adapter2, FakedAdapter)
-        self.assertEqual(adapter2.properties, adapter2_out_props)
-        self.assertEqual(adapter2.manager, cpc1.adapters)
+        assert isinstance(adapter2, FakedAdapter)
+        assert adapter2.properties == adapter2_out_props
+        assert adapter2.manager == cpc1.adapters
 
     def test_adapters_remove(self):
         """Test remove() of FakedAdapterManager."""
@@ -565,19 +558,19 @@ class FakedAdapterTests(unittest.TestCase):
         cpc1 = cpcs[0]
         adapters = cpc1.adapters.list()
         adapter1 = adapters[0]
-        self.assertEqual(len(adapters), 1)
+        assert len(adapters) == 1
 
         # the function to be tested:
         cpc1.adapters.remove(adapter1.oid)
 
         adapters = cpc1.adapters.list()
-        self.assertEqual(len(adapters), 0)
+        assert len(adapters) == 0
 
 
-class FakedCpcTests(unittest.TestCase):
+class TestFakedCpc(object):
     """All tests for the FakedCpcManager and FakedCpc classes."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc = FakedHmc('fake-hmc', '2.13.1', '1.8')
         self.cpc1_in_props = {'name': 'cpc1'}
         rd = {
@@ -599,16 +592,14 @@ class FakedCpcTests(unittest.TestCase):
 
         repr_str = repr_str.replace('\n', '\\n')
         # We check just the begin of the string:
-        self.assertRegexpMatches(
-            repr_str,
-            r'^{classname}\s+at\s+0x{id:08x}\s+\(\\n.*'.format(
-                classname=cpc.__class__.__name__,
-                id=id(cpc)))
+        assert re.match(r'^{classname}\s+at\s+0x{id:08x}\s+\(\\n.*'.
+                        format(classname=cpc.__class__.__name__, id=id(cpc)),
+                        repr_str)
 
     def test_cpcs_attr(self):
         """Test HMC 'cpcs' attribute."""
-        self.assertIsInstance(self.hmc.cpcs, FakedCpcManager)
-        self.assertRegexpMatches(self.hmc.cpcs.base_uri, r'/api/cpcs')
+        assert isinstance(self.hmc.cpcs, FakedCpcManager)
+        assert re.match(r'/api/cpcs', self.hmc.cpcs.base_uri)
 
     def test_cpcs_list(self):
         """Test list() of FakedCpcManager."""
@@ -625,26 +616,26 @@ class FakedCpcTests(unittest.TestCase):
             'is-ensemble-member': False,
             'status': 'operating',
         })
-        self.assertIsInstance(cpc1, FakedCpc)
-        self.assertEqual(cpc1.properties, cpc1_out_props)
-        self.assertEqual(cpc1.manager, self.hmc.cpcs)
+        assert isinstance(cpc1, FakedCpc)
+        assert cpc1.properties == cpc1_out_props
+        assert cpc1.manager == self.hmc.cpcs
 
         # Quick check of child resources:
-        self.assertIsInstance(cpc1.lpars, FakedLparManager)
-        self.assertIsInstance(cpc1.partitions, FakedPartitionManager)
-        self.assertIsInstance(cpc1.adapters, FakedAdapterManager)
-        self.assertIsInstance(cpc1.virtual_switches, FakedVirtualSwitchManager)
-        self.assertIsInstance(cpc1.reset_activation_profiles,
-                              FakedActivationProfileManager)
-        self.assertIsInstance(cpc1.image_activation_profiles,
-                              FakedActivationProfileManager)
-        self.assertIsInstance(cpc1.load_activation_profiles,
-                              FakedActivationProfileManager)
+        assert isinstance(cpc1.lpars, FakedLparManager)
+        assert isinstance(cpc1.partitions, FakedPartitionManager)
+        assert isinstance(cpc1.adapters, FakedAdapterManager)
+        assert isinstance(cpc1.virtual_switches, FakedVirtualSwitchManager)
+        assert isinstance(cpc1.reset_activation_profiles,
+                          FakedActivationProfileManager)
+        assert isinstance(cpc1.image_activation_profiles,
+                          FakedActivationProfileManager)
+        assert isinstance(cpc1.load_activation_profiles,
+                          FakedActivationProfileManager)
 
     def test_cpcs_add(self):
         """Test add() of FakedCpcManager."""
         cpcs = self.hmc.cpcs.list()
-        self.assertEqual(len(cpcs), 1)
+        assert len(cpcs) == 1
 
         cpc2_in_props = {'name': 'cpc2'}
 
@@ -652,13 +643,13 @@ class FakedCpcTests(unittest.TestCase):
         new_cpc = self.hmc.cpcs.add(cpc2_in_props)
 
         cpcs = self.hmc.cpcs.list()
-        self.assertEqual(len(cpcs), 2)
+        assert len(cpcs) == 2
 
         cpc2 = [cpc for cpc in cpcs
                 if cpc.properties['name'] == cpc2_in_props['name']][0]
 
-        self.assertEqual(new_cpc.properties, cpc2.properties)
-        self.assertEqual(new_cpc.manager, cpc2.manager)
+        assert new_cpc.properties == cpc2.properties
+        assert new_cpc.manager == cpc2.manager
 
         cpc2_out_props = cpc2_in_props.copy()
         cpc2_out_props.update({
@@ -668,27 +659,27 @@ class FakedCpcTests(unittest.TestCase):
             'is-ensemble-member': False,
             'status': 'operating',
         })
-        self.assertIsInstance(cpc2, FakedCpc)
-        self.assertEqual(cpc2.properties, cpc2_out_props)
-        self.assertEqual(cpc2.manager, self.hmc.cpcs)
+        assert isinstance(cpc2, FakedCpc)
+        assert cpc2.properties == cpc2_out_props
+        assert cpc2.manager == self.hmc.cpcs
 
     def test_cpcs_remove(self):
         """Test remove() of FakedCpcManager."""
         cpcs = self.hmc.cpcs.list()
         cpc1 = cpcs[0]
-        self.assertEqual(len(cpcs), 1)
+        assert len(cpcs) == 1
 
         # the function to be tested:
         self.hmc.cpcs.remove(cpc1.oid)
 
         cpcs = self.hmc.cpcs.list()
-        self.assertEqual(len(cpcs), 0)
+        assert len(cpcs) == 0
 
 
-class FakedHbaTests(unittest.TestCase):
+class TestFakedHba(object):
     """All tests for the FakedHbaManager and FakedHba classes."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc = FakedHmc('fake-hmc', '2.13.1', '1.8')
 
         self.adapter1_oid = '747-abc-12345'
@@ -747,9 +738,9 @@ class FakedHbaTests(unittest.TestCase):
         partitions = cpc1.partitions.list()
         partition1 = partitions[0]
 
-        self.assertIsInstance(partition1.hbas, FakedHbaManager)
-        self.assertRegexpMatches(partition1.hbas.base_uri,
-                                 r'/api/partitions/[^/]+/hbas')
+        assert isinstance(partition1.hbas, FakedHbaManager)
+        assert re.match(r'/api/partitions/[^/]+/hbas',
+                        partition1.hbas.base_uri)
 
     def test_hbas_list(self):
         """Test list() of FakedHbaManager."""
@@ -761,7 +752,7 @@ class FakedHbaTests(unittest.TestCase):
         # the function to be tested:
         hbas = partition1.hbas.list()
 
-        self.assertEqual(len(hbas), 1)
+        assert len(hbas) == 1
         hba1 = hbas[0]
         hba1_out_props = self.hba1_in_props.copy()
         hba1_out_props.update({
@@ -770,9 +761,9 @@ class FakedHbaTests(unittest.TestCase):
             'device-number': hba1.properties['device-number'],
             'wwpn': hba1.properties['wwpn'],
         })
-        self.assertIsInstance(hba1, FakedHba)
-        self.assertEqual(hba1.properties, hba1_out_props)
-        self.assertEqual(hba1.manager, partition1.hbas)
+        assert isinstance(hba1, FakedHba)
+        assert hba1.properties == hba1_out_props
+        assert hba1.manager == partition1.hbas
 
     def test_hbas_add(self):
         """Test add() of FakedHbaManager."""
@@ -781,7 +772,7 @@ class FakedHbaTests(unittest.TestCase):
         partitions = cpc1.partitions.list()
         partition1 = partitions[0]
         hbas = partition1.hbas.list()
-        self.assertEqual(len(hbas), 1)
+        assert len(hbas) == 1
 
         hba2_oid = '22-55-xy'
         port_uri = '/api/adapters/abc-123/storage-ports/42'
@@ -799,22 +790,22 @@ class FakedHbaTests(unittest.TestCase):
             hba2_in_props)
 
         hbas = partition1.hbas.list()
-        self.assertEqual(len(hbas), 2)
+        assert len(hbas) == 2
 
         hba2 = [hba for hba in hbas
                 if hba.properties['name'] == hba2_in_props['name']][0]
 
-        self.assertEqual(new_hba.properties, hba2.properties)
-        self.assertEqual(new_hba.manager, hba2.manager)
+        assert new_hba.properties == hba2.properties
+        assert new_hba.manager == hba2.manager
 
         hba2_out_props = hba2_in_props.copy()
         hba2_out_props.update({
             'element-id': hba2_oid,
             'element-uri': hba2.uri,
         })
-        self.assertIsInstance(hba2, FakedHba)
-        self.assertEqual(hba2.properties, hba2_out_props)
-        self.assertEqual(hba2.manager, partition1.hbas)
+        assert isinstance(hba2, FakedHba)
+        assert hba2.properties == hba2_out_props
+        assert hba2.manager == partition1.hbas
 
     def test_hbas_remove(self):
         """Test remove() of FakedHbaManager."""
@@ -824,21 +815,21 @@ class FakedHbaTests(unittest.TestCase):
         partition1 = partitions[0]
         hbas = partition1.hbas.list()
         hba1 = hbas[0]
-        self.assertEqual(len(hbas), 1)
+        assert len(hbas) == 1
 
         # the function to be tested:
         partition1.hbas.remove(hba1.oid)
 
         hbas = partition1.hbas.list()
-        self.assertEqual(len(hbas), 0)
+        assert len(hbas) == 0
 
     # TODO: Add testcases for updating 'hba-uris' parent property
 
 
-class FakedLparTests(unittest.TestCase):
+class TestFakedLpar(object):
     """All tests for the FakedLparManager and FakedLpar classes."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc = FakedHmc('fake-hmc', '2.13.1', '1.8')
         self.cpc1_in_props = {'name': 'cpc1'}
         self.lpar1_in_props = {'name': 'lpar1'}
@@ -860,9 +851,8 @@ class FakedLparTests(unittest.TestCase):
         cpcs = self.hmc.cpcs.list()
         cpc1 = cpcs[0]
 
-        self.assertIsInstance(cpc1.lpars, FakedLparManager)
-        self.assertRegexpMatches(cpc1.lpars.base_uri,
-                                 r'/api/logical-partitions')
+        assert isinstance(cpc1.lpars, FakedLparManager)
+        assert re.match(r'/api/logical-partitions', cpc1.lpars.base_uri)
 
     def test_lpars_list(self):
         """Test list() of FakedLparManager."""
@@ -872,7 +862,7 @@ class FakedLparTests(unittest.TestCase):
         # the function to be tested:
         lpars = cpc1.lpars.list()
 
-        self.assertEqual(len(lpars), 1)
+        assert len(lpars) == 1
         lpar1 = lpars[0]
         lpar1_out_props = self.lpar1_in_props.copy()
         lpar1_out_props.update({
@@ -880,16 +870,16 @@ class FakedLparTests(unittest.TestCase):
             'object-uri': lpar1.uri,
             'status': 'not-activated',
         })
-        self.assertIsInstance(lpar1, FakedLpar)
-        self.assertEqual(lpar1.properties, lpar1_out_props)
-        self.assertEqual(lpar1.manager, cpc1.lpars)
+        assert isinstance(lpar1, FakedLpar)
+        assert lpar1.properties == lpar1_out_props
+        assert lpar1.manager == cpc1.lpars
 
     def test_lpars_add(self):
         """Test add() of FakedLparManager."""
         cpcs = self.hmc.cpcs.list()
         cpc1 = cpcs[0]
         lpars = cpc1.lpars.list()
-        self.assertEqual(len(lpars), 1)
+        assert len(lpars) == 1
 
         lpar2_in_props = {'name': 'lpar2'}
 
@@ -898,13 +888,13 @@ class FakedLparTests(unittest.TestCase):
             lpar2_in_props)
 
         lpars = cpc1.lpars.list()
-        self.assertEqual(len(lpars), 2)
+        assert len(lpars) == 2
 
         lpar2 = [p for p in lpars
                  if p.properties['name'] == lpar2_in_props['name']][0]
 
-        self.assertEqual(new_lpar.properties, lpar2.properties)
-        self.assertEqual(new_lpar.manager, lpar2.manager)
+        assert new_lpar.properties == lpar2.properties
+        assert new_lpar.manager == lpar2.manager
 
         lpar2_out_props = lpar2_in_props.copy()
         lpar2_out_props.update({
@@ -912,9 +902,9 @@ class FakedLparTests(unittest.TestCase):
             'object-uri': lpar2.uri,
             'status': 'not-activated',
         })
-        self.assertIsInstance(lpar2, FakedLpar)
-        self.assertEqual(lpar2.properties, lpar2_out_props)
-        self.assertEqual(lpar2.manager, cpc1.lpars)
+        assert isinstance(lpar2, FakedLpar)
+        assert lpar2.properties == lpar2_out_props
+        assert lpar2.manager == cpc1.lpars
 
     def test_lpars_remove(self):
         """Test remove() of FakedLparManager."""
@@ -922,19 +912,19 @@ class FakedLparTests(unittest.TestCase):
         cpc1 = cpcs[0]
         lpars = cpc1.lpars.list()
         lpar1 = lpars[0]
-        self.assertEqual(len(lpars), 1)
+        assert len(lpars) == 1
 
         # the function to be tested:
         cpc1.lpars.remove(lpar1.oid)
 
         lpars = cpc1.lpars.list()
-        self.assertEqual(len(lpars), 0)
+        assert len(lpars) == 0
 
 
-class FakedNicTests(unittest.TestCase):
+class TestFakedNic(object):
     """All tests for the FakedNicManager and FakedNic classes."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc = FakedHmc('fake-hmc', '2.13.1', '1.8')
 
         self.adapter1_oid = '380-xyz-12345'
@@ -993,9 +983,9 @@ class FakedNicTests(unittest.TestCase):
         partitions = cpc1.partitions.list()
         partition1 = partitions[0]
 
-        self.assertIsInstance(partition1.nics, FakedNicManager)
-        self.assertRegexpMatches(partition1.nics.base_uri,
-                                 r'/api/partitions/[^/]+/nics')
+        assert isinstance(partition1.nics, FakedNicManager)
+        assert re.match(r'/api/partitions/[^/]+/nics',
+                        partition1.nics.base_uri)
 
     def test_nics_list(self):
         """Test list() of FakedNicManager."""
@@ -1007,7 +997,7 @@ class FakedNicTests(unittest.TestCase):
         # the function to be tested:
         nics = partition1.nics.list()
 
-        self.assertEqual(len(nics), 1)
+        assert len(nics) == 1
         nic1 = nics[0]
         nic1_out_props = self.nic1_in_props.copy()
         nic1_out_props.update({
@@ -1015,9 +1005,9 @@ class FakedNicTests(unittest.TestCase):
             'element-uri': nic1.uri,
             'device-number': nic1.properties['device-number'],
         })
-        self.assertIsInstance(nic1, FakedNic)
-        self.assertEqual(nic1.properties, nic1_out_props)
-        self.assertEqual(nic1.manager, partition1.nics)
+        assert isinstance(nic1, FakedNic)
+        assert nic1.properties == nic1_out_props
+        assert nic1.manager == partition1.nics
 
     def test_nics_add(self):
         """Test add() of FakedNicManager."""
@@ -1026,7 +1016,7 @@ class FakedNicTests(unittest.TestCase):
         partitions = cpc1.partitions.list()
         partition1 = partitions[0]
         nics = partition1.nics.list()
-        self.assertEqual(len(nics), 1)
+        assert len(nics) == 1
 
         nic2_oid = '77-55-ab'
         port_uri = '/api/adapters/abc-123/network-ports/42'
@@ -1042,13 +1032,13 @@ class FakedNicTests(unittest.TestCase):
             nic2_in_props)
 
         nics = partition1.nics.list()
-        self.assertEqual(len(nics), 2)
+        assert len(nics) == 2
 
         nic2 = [nic for nic in nics
                 if nic.properties['name'] == nic2_in_props['name']][0]
 
-        self.assertEqual(new_nic.properties, nic2.properties)
-        self.assertEqual(new_nic.manager, nic2.manager)
+        assert new_nic.properties == nic2.properties
+        assert new_nic.manager == nic2.manager
 
         nic2_out_props = nic2_in_props.copy()
         nic2_out_props.update({
@@ -1056,9 +1046,9 @@ class FakedNicTests(unittest.TestCase):
             'element-uri': nic2.uri,
             'device-number': nic2.properties['device-number'],
         })
-        self.assertIsInstance(nic2, FakedNic)
-        self.assertEqual(nic2.properties, nic2_out_props)
-        self.assertEqual(nic2.manager, partition1.nics)
+        assert isinstance(nic2, FakedNic)
+        assert nic2.properties == nic2_out_props
+        assert nic2.manager == partition1.nics
 
     def test_nics_remove(self):
         """Test remove() of FakedNicManager."""
@@ -1068,21 +1058,21 @@ class FakedNicTests(unittest.TestCase):
         partition1 = partitions[0]
         nics = partition1.nics.list()
         nic1 = nics[0]
-        self.assertEqual(len(nics), 1)
+        assert len(nics) == 1
 
         # the function to be tested:
         partition1.nics.remove(nic1.oid)
 
         nics = partition1.nics.list()
-        self.assertEqual(len(nics), 0)
+        assert len(nics) == 0
 
     # TODO: Add testcases for updating 'nic-uris' parent property
 
 
-class FakedPartitionTests(unittest.TestCase):
+class TestFakedPartition(object):
     """All tests for the FakedPartitionManager and FakedPartition classes."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc = FakedHmc('fake-hmc', '2.13.1', '1.8')
         self.cpc1_in_props = {'name': 'cpc1'}
         self.partition1_in_props = {'name': 'partition1'}
@@ -1110,19 +1100,18 @@ class FakedPartitionTests(unittest.TestCase):
 
         repr_str = repr_str.replace('\n', '\\n')
         # We check just the begin of the string:
-        self.assertRegexpMatches(
-            repr_str,
-            r'^{classname}\s+at\s+0x{id:08x}\s+\(\\n.*'.format(
-                classname=partition.__class__.__name__,
-                id=id(partition)))
+        assert re.match(r'^{classname}\s+at\s+0x{id:08x}\s+\(\\n.*'.
+                        format(classname=partition.__class__.__name__,
+                               id=id(partition)),
+                        repr_str)
 
     def test_partitions_attr(self):
         """Test CPC 'partitions' attribute."""
         cpcs = self.hmc.cpcs.list()
         cpc1 = cpcs[0]
 
-        self.assertIsInstance(cpc1.partitions, FakedPartitionManager)
-        self.assertRegexpMatches(cpc1.partitions.base_uri, r'/api/partitions')
+        assert isinstance(cpc1.partitions, FakedPartitionManager)
+        assert re.match(r'/api/partitions', cpc1.partitions.base_uri)
 
     def test_partitions_list(self):
         """Test list() of FakedPartitionManager."""
@@ -1132,7 +1121,7 @@ class FakedPartitionTests(unittest.TestCase):
         # the function to be tested:
         partitions = cpc1.partitions.list()
 
-        self.assertEqual(len(partitions), 1)
+        assert len(partitions) == 1
         partition1 = partitions[0]
         partition1_out_props = self.partition1_in_props.copy()
         partition1_out_props.update({
@@ -1143,16 +1132,16 @@ class FakedPartitionTests(unittest.TestCase):
             'nic-uris': [],
             'virtual-function-uris': [],
         })
-        self.assertIsInstance(partition1, FakedPartition)
-        self.assertEqual(partition1.properties, partition1_out_props)
-        self.assertEqual(partition1.manager, cpc1.partitions)
+        assert isinstance(partition1, FakedPartition)
+        assert partition1.properties == partition1_out_props
+        assert partition1.manager == cpc1.partitions
 
     def test_partitions_add(self):
         """Test add() of FakedPartitionManager."""
         cpcs = self.hmc.cpcs.list()
         cpc1 = cpcs[0]
         partitions = cpc1.partitions.list()
-        self.assertEqual(len(partitions), 1)
+        assert len(partitions) == 1
 
         partition2_in_props = {'name': 'partition2'}
 
@@ -1161,14 +1150,14 @@ class FakedPartitionTests(unittest.TestCase):
             partition2_in_props)
 
         partitions = cpc1.partitions.list()
-        self.assertEqual(len(partitions), 2)
+        assert len(partitions) == 2
 
         partition2 = [p for p in partitions
                       if p.properties['name'] ==
                       partition2_in_props['name']][0]
 
-        self.assertEqual(new_partition.properties, partition2.properties)
-        self.assertEqual(new_partition.manager, partition2.manager)
+        assert new_partition.properties == partition2.properties
+        assert new_partition.manager == partition2.manager
 
         partition2_out_props = partition2_in_props.copy()
         partition2_out_props.update({
@@ -1179,9 +1168,9 @@ class FakedPartitionTests(unittest.TestCase):
             'nic-uris': [],
             'virtual-function-uris': [],
         })
-        self.assertIsInstance(partition2, FakedPartition)
-        self.assertEqual(partition2.properties, partition2_out_props)
-        self.assertEqual(partition2.manager, cpc1.partitions)
+        assert isinstance(partition2, FakedPartition)
+        assert partition2.properties == partition2_out_props
+        assert partition2.manager == cpc1.partitions
 
     def test_partitions_remove(self):
         """Test remove() of FakedPartitionManager."""
@@ -1189,19 +1178,19 @@ class FakedPartitionTests(unittest.TestCase):
         cpc1 = cpcs[0]
         partitions = cpc1.partitions.list()
         partition1 = partitions[0]
-        self.assertEqual(len(partitions), 1)
+        assert len(partitions) == 1
 
         # the function to be tested:
         cpc1.partitions.remove(partition1.oid)
 
         partitions = cpc1.partitions.list()
-        self.assertEqual(len(partitions), 0)
+        assert len(partitions) == 0
 
 
-class FakedPortTests(unittest.TestCase):
+class TestFakedPort(object):
     """All tests for the FakedPortManager and FakedPort classes."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc = FakedHmc('fake-hmc', '2.13.1', '1.8')
         self.cpc1_in_props = {'name': 'cpc1'}
         self.adapter1_in_props = {'name': 'adapter1', 'adapter-family': 'osa'}
@@ -1231,9 +1220,9 @@ class FakedPortTests(unittest.TestCase):
         adapters = cpc1.adapters.list()
         adapter1 = adapters[0]
 
-        self.assertIsInstance(adapter1.ports, FakedPortManager)
-        self.assertRegexpMatches(adapter1.ports.base_uri,
-                                 r'/api/adapters/[^/]+/network-ports')
+        assert isinstance(adapter1.ports, FakedPortManager)
+        assert re.match(r'/api/adapters/[^/]+/network-ports',
+                        adapter1.ports.base_uri)
 
     def test_ports_list(self):
         """Test list() of FakedPortManager."""
@@ -1245,16 +1234,16 @@ class FakedPortTests(unittest.TestCase):
         # the function to be tested:
         ports = adapter1.ports.list()
 
-        self.assertEqual(len(ports), 1)
+        assert len(ports) == 1
         port1 = ports[0]
         port1_out_props = self.port1_in_props.copy()
         port1_out_props.update({
             'element-id': port1.oid,
             'element-uri': port1.uri,
         })
-        self.assertIsInstance(port1, FakedPort)
-        self.assertEqual(port1.properties, port1_out_props)
-        self.assertEqual(port1.manager, adapter1.ports)
+        assert isinstance(port1, FakedPort)
+        assert port1.properties == port1_out_props
+        assert port1.manager == adapter1.ports
 
     def test_ports_add(self):
         """Test add() of FakedPortManager."""
@@ -1263,7 +1252,7 @@ class FakedPortTests(unittest.TestCase):
         adapters = cpc1.adapters.list()
         adapter1 = adapters[0]
         ports = adapter1.ports.list()
-        self.assertEqual(len(ports), 1)
+        assert len(ports) == 1
 
         port2_in_props = {'name': 'port2'}
 
@@ -1272,22 +1261,22 @@ class FakedPortTests(unittest.TestCase):
             port2_in_props)
 
         ports = adapter1.ports.list()
-        self.assertEqual(len(ports), 2)
+        assert len(ports) == 2
 
         port2 = [p for p in ports
                  if p.properties['name'] == port2_in_props['name']][0]
 
-        self.assertEqual(new_port.properties, port2.properties)
-        self.assertEqual(new_port.manager, port2.manager)
+        assert new_port.properties == port2.properties
+        assert new_port.manager == port2.manager
 
         port2_out_props = port2_in_props.copy()
         port2_out_props.update({
             'element-id': port2.oid,
             'element-uri': port2.uri,
         })
-        self.assertIsInstance(port2, FakedPort)
-        self.assertEqual(port2.properties, port2_out_props)
-        self.assertEqual(port2.manager, adapter1.ports)
+        assert isinstance(port2, FakedPort)
+        assert port2.properties == port2_out_props
+        assert port2.manager == adapter1.ports
 
     def test_ports_remove(self):
         """Test remove() of FakedPortManager."""
@@ -1297,23 +1286,23 @@ class FakedPortTests(unittest.TestCase):
         adapter1 = adapters[0]
         ports = adapter1.ports.list()
         port1 = ports[0]
-        self.assertEqual(len(ports), 1)
+        assert len(ports) == 1
 
         # the function to be tested:
         adapter1.ports.remove(port1.oid)
 
         ports = adapter1.ports.list()
-        self.assertEqual(len(ports), 0)
+        assert len(ports) == 0
 
     # TODO: Add testcases for updating 'network-port-uris' and
     #       'storage-port-uris' parent properties
 
 
-class FakedVirtualFunctionTests(unittest.TestCase):
+class TestFakedVirtualFunction(object):
     """All tests for the FakedVirtualFunctionManager and FakedVirtualFunction
     classes."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc = FakedHmc('fake-hmc', '2.13.1', '1.8')
         self.cpc1_in_props = {'name': 'cpc1'}
         self.partition1_in_props = {'name': 'partition1'}
@@ -1344,10 +1333,10 @@ class FakedVirtualFunctionTests(unittest.TestCase):
         partitions = cpc1.partitions.list()
         partition1 = partitions[0]
 
-        self.assertIsInstance(partition1.virtual_functions,
-                              FakedVirtualFunctionManager)
-        self.assertRegexpMatches(partition1.virtual_functions.base_uri,
-                                 r'/api/partitions/[^/]+/virtual-functions')
+        assert isinstance(partition1.virtual_functions,
+                          FakedVirtualFunctionManager)
+        assert re.match(r'/api/partitions/[^/]+/virtual-functions',
+                        partition1.virtual_functions.base_uri)
 
     def test_virtual_functions_list(self):
         """Test list() of FakedVirtualFunctionManager."""
@@ -1359,7 +1348,7 @@ class FakedVirtualFunctionTests(unittest.TestCase):
         # the function to be tested:
         virtual_functions = partition1.virtual_functions.list()
 
-        self.assertEqual(len(virtual_functions), 1)
+        assert len(virtual_functions) == 1
         virtual_function1 = virtual_functions[0]
         virtual_function1_out_props = self.virtual_function1_in_props.copy()
         virtual_function1_out_props.update({
@@ -1367,11 +1356,9 @@ class FakedVirtualFunctionTests(unittest.TestCase):
             'element-uri': virtual_function1.uri,
             'device-number': virtual_function1.properties['device-number'],
         })
-        self.assertIsInstance(virtual_function1, FakedVirtualFunction)
-        self.assertEqual(virtual_function1.properties,
-                         virtual_function1_out_props)
-        self.assertEqual(virtual_function1.manager,
-                         partition1.virtual_functions)
+        assert isinstance(virtual_function1, FakedVirtualFunction)
+        assert virtual_function1.properties == virtual_function1_out_props
+        assert virtual_function1.manager == partition1.virtual_functions
 
     def test_virtual_functions_add(self):
         """Test add() of FakedVirtualFunctionManager."""
@@ -1380,7 +1367,7 @@ class FakedVirtualFunctionTests(unittest.TestCase):
         partitions = cpc1.partitions.list()
         partition1 = partitions[0]
         virtual_functions = partition1.virtual_functions.list()
-        self.assertEqual(len(virtual_functions), 1)
+        assert len(virtual_functions) == 1
 
         virtual_function2_in_props = {'name': 'virtual_function2'}
 
@@ -1389,16 +1376,14 @@ class FakedVirtualFunctionTests(unittest.TestCase):
             virtual_function2_in_props)
 
         virtual_functions = partition1.virtual_functions.list()
-        self.assertEqual(len(virtual_functions), 2)
+        assert len(virtual_functions) == 2
 
         virtual_function2 = [vf for vf in virtual_functions
                              if vf.properties['name'] ==
                              virtual_function2_in_props['name']][0]
 
-        self.assertEqual(new_virtual_function.properties,
-                         virtual_function2.properties)
-        self.assertEqual(new_virtual_function.manager,
-                         virtual_function2.manager)
+        assert new_virtual_function.properties == virtual_function2.properties
+        assert new_virtual_function.manager == virtual_function2.manager
 
         virtual_function2_out_props = virtual_function2_in_props.copy()
         virtual_function2_out_props.update({
@@ -1406,11 +1391,9 @@ class FakedVirtualFunctionTests(unittest.TestCase):
             'element-uri': virtual_function2.uri,
             'device-number': virtual_function2.properties['device-number'],
         })
-        self.assertIsInstance(virtual_function2, FakedVirtualFunction)
-        self.assertEqual(virtual_function2.properties,
-                         virtual_function2_out_props)
-        self.assertEqual(virtual_function2.manager,
-                         partition1.virtual_functions)
+        assert isinstance(virtual_function2, FakedVirtualFunction)
+        assert virtual_function2.properties == virtual_function2_out_props
+        assert virtual_function2.manager == partition1.virtual_functions
 
     def test_virtual_functions_remove(self):
         """Test remove() of FakedVirtualFunctionManager."""
@@ -1420,22 +1403,22 @@ class FakedVirtualFunctionTests(unittest.TestCase):
         partition1 = partitions[0]
         virtual_functions = partition1.virtual_functions.list()
         virtual_function1 = virtual_functions[0]
-        self.assertEqual(len(virtual_functions), 1)
+        assert len(virtual_functions) == 1
 
         # the function to be tested:
         partition1.virtual_functions.remove(virtual_function1.oid)
 
         virtual_functions = partition1.virtual_functions.list()
-        self.assertEqual(len(virtual_functions), 0)
+        assert len(virtual_functions) == 0
 
     # TODO: Add testcases for updating 'virtual-function-uris' parent property
 
 
-class FakedVirtualSwitchTests(unittest.TestCase):
+class TestFakedVirtualSwitch(object):
     """All tests for the FakedVirtualSwitchManager and FakedVirtualSwitch
     classes."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc = FakedHmc('fake-hmc', '2.13.1', '1.8')
         self.cpc1_in_props = {'name': 'cpc1'}
         self.virtual_switch1_in_props = {'name': 'virtual_switch1'}
@@ -1457,9 +1440,9 @@ class FakedVirtualSwitchTests(unittest.TestCase):
         cpcs = self.hmc.cpcs.list()
         cpc1 = cpcs[0]
 
-        self.assertIsInstance(cpc1.virtual_switches, FakedVirtualSwitchManager)
-        self.assertRegexpMatches(cpc1.virtual_switches.base_uri,
-                                 r'/api/virtual-switches')
+        assert isinstance(cpc1.virtual_switches, FakedVirtualSwitchManager)
+        assert re.match(r'/api/virtual-switches',
+                        cpc1.virtual_switches.base_uri)
 
     def test_virtual_switches_list(self):
         """Test list() of FakedVirtualSwitchManager."""
@@ -1469,7 +1452,7 @@ class FakedVirtualSwitchTests(unittest.TestCase):
         # the function to be tested:
         virtual_switches = cpc1.virtual_switches.list()
 
-        self.assertEqual(len(virtual_switches), 1)
+        assert len(virtual_switches) == 1
         virtual_switch1 = virtual_switches[0]
         virtual_switch1_out_props = self.virtual_switch1_in_props.copy()
         virtual_switch1_out_props.update({
@@ -1477,16 +1460,16 @@ class FakedVirtualSwitchTests(unittest.TestCase):
             'object-uri': virtual_switch1.uri,
             'connected-vnic-uris': [],
         })
-        self.assertIsInstance(virtual_switch1, FakedVirtualSwitch)
-        self.assertEqual(virtual_switch1.properties, virtual_switch1_out_props)
-        self.assertEqual(virtual_switch1.manager, cpc1.virtual_switches)
+        assert isinstance(virtual_switch1, FakedVirtualSwitch)
+        assert virtual_switch1.properties == virtual_switch1_out_props
+        assert virtual_switch1.manager == cpc1.virtual_switches
 
     def test_virtual_switches_add(self):
         """Test add() of FakedVirtualSwitchManager."""
         cpcs = self.hmc.cpcs.list()
         cpc1 = cpcs[0]
         virtual_switches = cpc1.virtual_switches.list()
-        self.assertEqual(len(virtual_switches), 1)
+        assert len(virtual_switches) == 1
 
         virtual_switch2_in_props = {'name': 'virtual_switch2'}
 
@@ -1495,16 +1478,14 @@ class FakedVirtualSwitchTests(unittest.TestCase):
             virtual_switch2_in_props)
 
         virtual_switches = cpc1.virtual_switches.list()
-        self.assertEqual(len(virtual_switches), 2)
+        assert len(virtual_switches) == 2
 
         virtual_switch2 = [p for p in virtual_switches
                            if p.properties['name'] ==
                            virtual_switch2_in_props['name']][0]
 
-        self.assertEqual(new_virtual_switch.properties,
-                         virtual_switch2.properties)
-        self.assertEqual(new_virtual_switch.manager,
-                         virtual_switch2.manager)
+        assert new_virtual_switch.properties == virtual_switch2.properties
+        assert new_virtual_switch.manager == virtual_switch2.manager
 
         virtual_switch2_out_props = virtual_switch2_in_props.copy()
         virtual_switch2_out_props.update({
@@ -1512,9 +1493,9 @@ class FakedVirtualSwitchTests(unittest.TestCase):
             'object-uri': virtual_switch2.uri,
             'connected-vnic-uris': [],
         })
-        self.assertIsInstance(virtual_switch2, FakedVirtualSwitch)
-        self.assertEqual(virtual_switch2.properties, virtual_switch2_out_props)
-        self.assertEqual(virtual_switch2.manager, cpc1.virtual_switches)
+        assert isinstance(virtual_switch2, FakedVirtualSwitch)
+        assert virtual_switch2.properties == virtual_switch2_out_props
+        assert virtual_switch2.manager == cpc1.virtual_switches
 
     def test_virtual_switches_remove(self):
         """Test remove() of FakedVirtualSwitchManager."""
@@ -1522,20 +1503,20 @@ class FakedVirtualSwitchTests(unittest.TestCase):
         cpc1 = cpcs[0]
         virtual_switches = cpc1.virtual_switches.list()
         virtual_switch1 = virtual_switches[0]
-        self.assertEqual(len(virtual_switches), 1)
+        assert len(virtual_switches) == 1
 
         # the function to be tested:
         cpc1.virtual_switches.remove(virtual_switch1.oid)
 
         virtual_switches = cpc1.virtual_switches.list()
-        self.assertEqual(len(virtual_switches), 0)
+        assert len(virtual_switches) == 0
 
 
-class FakedMetricsContextTests(unittest.TestCase):
+class TestFakedMetricsContext(object):
     """All tests for the FakedMetricsContextManager and FakedMetricsContext
     classes."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc = FakedHmc('fake-hmc', '2.13.1', '1.8')
         self.cpc1_in_props = {'name': 'cpc1'}
         self.partition1_in_props = {'name': 'partition1'}
@@ -1557,10 +1538,10 @@ class FakedMetricsContextTests(unittest.TestCase):
         """Test faked HMC 'metrics_contexts' attribute."""
         faked_hmc = self.hmc
 
-        self.assertIsInstance(faked_hmc.metrics_contexts,
-                              FakedMetricsContextManager)
-        self.assertRegexpMatches(faked_hmc.metrics_contexts.base_uri,
-                                 r'api/services/metrics/context')
+        assert isinstance(faked_hmc.metrics_contexts,
+                          FakedMetricsContextManager)
+        assert re.match(r'/api/services/metrics/context',
+                        faked_hmc.metrics_contexts.base_uri)
 
     def test_metrics_contexts_add(self):
         """Test add() of FakedMetricsContextManager."""
@@ -1574,16 +1555,15 @@ class FakedMetricsContextTests(unittest.TestCase):
         # the function to be tested:
         mc = faked_hmc.metrics_contexts.add(mc_in_props)
 
-        self.assertIsInstance(mc, FakedMetricsContext)
-        self.assertRegexpMatches(mc.uri,
-                                 r'api/services/metrics/context/[^/]+')
-        self.assertIs(mc.manager, faked_hmc.metrics_contexts)
+        assert isinstance(mc, FakedMetricsContext)
+        assert re.match(r'/api/services/metrics/context/[^/]+', mc.uri)
+        assert mc.manager is faked_hmc.metrics_contexts
         mc_props = mc_in_props.copy()
         mc_props.update({
             'fake-id': mc.oid,
             'fake-uri': mc.uri,
         })
-        self.assertEqual(mc.properties, mc_props)
+        assert mc.properties == mc_props
 
     def test_metrics_contexts_add_get_mg_def(self):
         """Test add_metric_group_definition(), get_metric_group_definition(),
@@ -1603,38 +1583,36 @@ class FakedMetricsContextTests(unittest.TestCase):
 
         # Verify the initial M.G.Def names
         mg_def_names = mc_mgr.get_metric_group_definition_names()
-        self.assertEqual(list(mg_def_names), [])
+        assert list(mg_def_names) == []
 
         # Verify that a M.G.Def can be added
         mc_mgr.add_metric_group_definition(mg_def_input)
 
         # Verify the M.G.Def names after having added one
         mg_def_names = mc_mgr.get_metric_group_definition_names()
-        self.assertEqual(list(mg_def_names), [mg_name])
+        assert list(mg_def_names) == [mg_name]
 
         # Verify that it can be retrieved
         mg_def = mc_mgr.get_metric_group_definition(mg_name)
-        self.assertEqual(mg_def, mg_def_input)
+        assert mg_def == mg_def_input
 
         # Verify that retrieving a non-existing M.G.Def fails
-        with self.assertRaises(ValueError) as cm:
+        with pytest.raises(ValueError) as exc_info:
             mc_mgr.get_metric_group_definition('foo')
-        exc = cm.exception
-        self.assertRegexpMatches(
-            str(exc),
-            r"^A metric group definition with this name does not exist:.*")
+        exc = exc_info.value
+        assert re.match(r"^A metric group definition with this name does "
+                        r"not exist:.*", str(exc))
 
         # Verify that adding an M.G.Def with an existing name fails
-        with self.assertRaises(ValueError) as cm:
+        with pytest.raises(ValueError) as exc_info:
             mc_mgr.add_metric_group_definition(mg_def_input)
-        exc = cm.exception
-        self.assertRegexpMatches(
-            str(exc),
-            r"^A metric group definition with this name already exists:.*")
+        exc = exc_info.value
+        assert re.match(r"^A metric group definition with this name already "
+                        r"exists:.*", str(exc))
 
         # Verify that the M.G.Def names have not changed in these fails
         mg_def_names = mc_mgr.get_metric_group_definition_names()
-        self.assertEqual(list(mg_def_names), [mg_name])
+        assert list(mg_def_names) == [mg_name]
 
     def test_metrics_contexts_add_get_metric_values(self):
         """Test add_metric_values(), get_metric_values(), and
@@ -1663,26 +1641,25 @@ class FakedMetricsContextTests(unittest.TestCase):
 
         # Verify the initial M.O.Val group names
         mo_val_group_names = mc_mgr.get_metric_values_group_names()
-        self.assertEqual(list(mo_val_group_names), [])
+        assert list(mo_val_group_names) == []
 
         # Verify that a first M.O.Val can be added
         mc_mgr.add_metric_values(mo_val_input)
 
         # Verify the M.O.Val group names after having added one
         mo_val_group_names = mc_mgr.get_metric_values_group_names()
-        self.assertEqual(list(mo_val_group_names), [mg_name])
+        assert list(mo_val_group_names) == [mg_name]
 
         # Verify that the M.O.Vals can be retrieved and contain the first one
         mo_vals = mc_mgr.get_metric_values(mg_name)
-        self.assertEqual(list(mo_vals), [mo_val_input])
+        assert list(mo_vals) == [mo_val_input]
 
         # Verify that retrieving a non-existing M.O.Val fails
-        with self.assertRaises(ValueError) as cm:
+        with pytest.raises(ValueError) as exc_info:
             mc_mgr.get_metric_values('foo')
-        exc = cm.exception
-        self.assertRegexpMatches(
-            str(exc),
-            r"^Metric values for this group name do not exist:.*")
+        exc = exc_info.value
+        assert re.match(r"^Metric values for this group name do not "
+                        r"exist:.*", str(exc))
 
         # Verify that a second M.O.Val can be added for the same group name
         mc_mgr.add_metric_values(mo_val2_input)
@@ -1690,11 +1667,11 @@ class FakedMetricsContextTests(unittest.TestCase):
         # Verify the M.O.Val group names after having added a second M.O.Val
         # for the same group name -> still just one group name
         mo_val_group_names = mc_mgr.get_metric_values_group_names()
-        self.assertEqual(list(mo_val_group_names), [mg_name])
+        assert list(mo_val_group_names) == [mg_name]
 
         # Verify that the M.O.Vals can be retrieved and contain both
         mo_vals = mc_mgr.get_metric_values(mg_name)
-        self.assertEqual(list(mo_vals), [mo_val_input, mo_val2_input])
+        assert list(mo_vals) == [mo_val_input, mo_val2_input]
 
     def test_metrics_context_get_mg_defs(self):
         """Test get_metric_group_definitions() of FakedMetricsContext."""
@@ -1732,7 +1709,7 @@ class FakedMetricsContextTests(unittest.TestCase):
         mg_defs = mc.get_metric_group_definitions()
 
         # Verify the returned M.G.Defs
-        self.assertEqual(list(mg_defs), exp_mg_defs)
+        assert list(mg_defs) == exp_mg_defs
 
         # Test case where the default for M.G.Defs is tested
         mc_in_props = {
@@ -1746,7 +1723,7 @@ class FakedMetricsContextTests(unittest.TestCase):
         mg_defs = mc.get_metric_group_definitions()
 
         # Verify the returned M.G.Defs
-        self.assertEqual(list(mg_defs), exp_mg_defs)
+        assert list(mg_defs) == exp_mg_defs
 
     def test_metrics_context_get_mg_infos(self):
         """Test get_metric_group_infos() of FakedMetricsContext."""
@@ -1810,7 +1787,7 @@ class FakedMetricsContextTests(unittest.TestCase):
         mg_infos = mc.get_metric_group_infos()
 
         # Verify the returned M.G.Defs
-        self.assertEqual(list(mg_infos), exp_mg_infos)
+        assert list(mg_infos) == exp_mg_infos
 
         # Test case where the default for M.G.Defs is tested
         mc_in_props = {
@@ -1824,7 +1801,7 @@ class FakedMetricsContextTests(unittest.TestCase):
         mg_infos = mc.get_metric_group_infos()
 
         # Verify the returned M.G.Defs
-        self.assertEqual(list(mg_infos), exp_mg_infos)
+        assert list(mg_infos) == exp_mg_infos
 
     def test_metrics_context_get_m_values(self):
         """Test get_metric_values() of FakedMetricsContext."""
@@ -1871,10 +1848,10 @@ class FakedMetricsContextTests(unittest.TestCase):
         # the function to be tested:
         mv_list = mc.get_metric_values()
 
-        self.assertEqual(len(mv_list), 1)
+        assert len(mv_list) == 1
         mv = mv_list[0]
-        self.assertEqual(mv[0], mg_name)
-        self.assertEqual(mv[1], exp_mo_vals)
+        assert mv[0] == mg_name
+        assert mv[1] == exp_mo_vals
 
     def test_metrics_context_get_m_values_response(self):
         """Test get_metric_values_response() of FakedMetricsContext."""
@@ -1959,14 +1936,13 @@ class FakedMetricsContextTests(unittest.TestCase):
         # the function to be tested:
         mv_resp = mc.get_metric_values_response()
 
-        self.assertEqual(
-            mv_resp, exp_mv_resp,
-            "Actual response string:\n{!r}\n"
-            "Expected response string:\n{!r}\n".
-            format(mv_resp, exp_mv_resp))
+        assert mv_resp == exp_mv_resp, \
+            "Actual response string:\n{!r}\n" \
+            "Expected response string:\n{!r}\n". \
+            format(mv_resp, exp_mv_resp)
 
 
-class FakedMetricGroupDefinitionTests(unittest.TestCase):
+class TestFakedMetricGroupDefinition(object):
     """All tests for the FakedMetricGroupDefinition class."""
 
     def test_metric_group_definition_attr(self):
@@ -1983,12 +1959,12 @@ class FakedMetricGroupDefinitionTests(unittest.TestCase):
         # the function to be tested:
         new_mgd = FakedMetricGroupDefinition(**in_kwargs)
 
-        self.assertEqual(new_mgd.name, in_kwargs['name'])
-        self.assertEqual(new_mgd.types, in_kwargs['types'])
-        self.assertIsNot(new_mgd.types, in_kwargs['types'])  # was copied
+        assert new_mgd.name == in_kwargs['name']
+        assert new_mgd.types == in_kwargs['types']
+        assert new_mgd.types is not in_kwargs['types']  # was copied
 
 
-class FakedMetricObjectValuesTests(unittest.TestCase):
+class TestFakedMetricObjectValues(object):
     """All tests for the FakedMetricObjectValues class."""
 
     def test_metric_object_values_attr(self):
@@ -2007,12 +1983,8 @@ class FakedMetricObjectValuesTests(unittest.TestCase):
         # the function to be tested:
         new_mov = FakedMetricObjectValues(**in_kwargs)
 
-        self.assertEqual(new_mov.group_name, in_kwargs['group_name'])
-        self.assertEqual(new_mov.resource_uri, in_kwargs['resource_uri'])
-        self.assertEqual(new_mov.timestamp, in_kwargs['timestamp'])
-        self.assertEqual(new_mov.values, in_kwargs['values'])
-        self.assertIsNot(new_mov.values, in_kwargs['values'])  # was copied
-
-
-if __name__ == '__main__':
-    unittest.main()
+        assert new_mov.group_name == in_kwargs['group_name']
+        assert new_mov.resource_uri == in_kwargs['resource_uri']
+        assert new_mov.timestamp == in_kwargs['timestamp']
+        assert new_mov.values == in_kwargs['values']
+        assert new_mov.values is not in_kwargs['values']  # was copied
diff --git a/tests/unit/zhmcclient_mock/test_idpool.py b/tests/unit/zhmcclient_mock/test_idpool.py
old mode 100755
new mode 100644
index 9c84f2e..36b8917
--- a/tests/unit/zhmcclient_mock/test_idpool.py
+++ b/tests/unit/zhmcclient_mock/test_idpool.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # Copyright 2017 IBM Corp. All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,30 +19,32 @@ Unit test cases for the _idpool module of the zhmcclient_mock package.
 from __future__ import absolute_import, print_function
 
 import requests.packages.urllib3
-import unittest
+import pytest
 
 from zhmcclient_mock._idpool import IdPool
 
+requests.packages.urllib3.disable_warnings()
 
-class IdPoolTests(unittest.TestCase):
+
+class TestIdPool(object):
     """All tests for class IdPool."""
 
     def test_init_error_1(self):
 
-        with self.assertRaises(ValueError):
+        with pytest.raises(ValueError):
             IdPool(7, 6)
 
     def test_invalid_free_error_1(self):
 
         pool = IdPool(5, 5)
 
-        with self.assertRaises(ValueError):
+        with pytest.raises(ValueError):
             pool.free(4)  # not in range
 
-        with self.assertRaises(ValueError):
+        with pytest.raises(ValueError):
             pool.free(5)  # in range but not allocated
 
-        with self.assertRaises(ValueError):
+        with pytest.raises(ValueError):
             pool.free(6)  # not in range
 
     def test_invalid_free_error_2(self):
@@ -70,10 +71,10 @@ class IdPoolTests(unittest.TestCase):
 
         # Verify uniqueness of the ID values
         id_set = set(id_list)
-        self.assertEqual(len(id_set), len(id_list))
+        assert len(id_set) == len(id_list)
 
         # Verify that the pool is exhausted
-        with self.assertRaises(ValueError):
+        with pytest.raises(ValueError):
             pool.alloc()
 
     def _test_free_for_lo_hi(self, lowest, highest):
@@ -93,7 +94,7 @@ class IdPoolTests(unittest.TestCase):
             pool.free(id)
 
         # Verify that nothing is used in the pool
-        self.assertEqual(len(pool._used), 0)
+        assert len(pool._used) == 0
 
         # Exhaust the pool
         id_list2 = []
@@ -102,10 +103,10 @@ class IdPoolTests(unittest.TestCase):
             id_list2.append(id)
 
         # Verify that the same ID values came back as last time
-        self.assertEqual(set(id_list1), set(id_list2))
+        assert set(id_list1) == set(id_list2)
 
         # Verify that the pool is exhausted
-        with self.assertRaises(ValueError):
+        with pytest.raises(ValueError):
             pool.alloc()
 
     def _test_all_for_lo_hi(self, lowest, highest):
@@ -147,8 +148,3 @@ class IdPoolTests(unittest.TestCase):
         self._test_all_for_lo_hi(11, 20)
         self._test_all_for_lo_hi(11, 21)
         self._test_all_for_lo_hi(11, 22)
-
-
-if __name__ == '__main__':
-    requests.packages.urllib3.disable_warnings()
-    unittest.main()
diff --git a/tests/unit/zhmcclient_mock/test_urihandler.py b/tests/unit/zhmcclient_mock/test_urihandler.py
old mode 100755
new mode 100644
index 5903556..5631d3f
--- a/tests/unit/zhmcclient_mock/test_urihandler.py
+++ b/tests/unit/zhmcclient_mock/test_urihandler.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # Copyright 2016-2017 IBM Corp. All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,9 +19,10 @@ Unit tests for _urihandler module of the zhmcclient_mock package.
 from __future__ import absolute_import, print_function
 
 import requests.packages.urllib3
-import unittest
 from datetime import datetime
+# FIXME: Migrate mock to zhmcclient_mock
 from mock import MagicMock
+import pytest
 
 from zhmcclient_mock._hmc import FakedHmc, FakedMetricGroupDefinition, \
     FakedMetricObjectValues
@@ -69,8 +69,10 @@ from zhmcclient_mock._urihandler import HTTPError, InvalidResourceError, \
     ImageActProfilesHandler, ImageActProfileHandler, \
     LoadActProfilesHandler, LoadActProfileHandler
 
+requests.packages.urllib3.disable_warnings()
 
-class HTTPErrorTests(unittest.TestCase):
+
+class TestHTTPError(object):
     """All tests for class HTTPError."""
 
     def test_attributes(self):
@@ -82,11 +84,11 @@ class HTTPErrorTests(unittest.TestCase):
 
         exc = HTTPError(method, uri, http_status, reason, message)
 
-        self.assertEqual(exc.method, method)
-        self.assertEqual(exc.uri, uri)
-        self.assertEqual(exc.http_status, http_status)
-        self.assertEqual(exc.reason, reason)
-        self.assertEqual(exc.message, message)
+        assert exc.method == method
+        assert exc.uri == uri
+        assert exc.http_status == http_status
+        assert exc.reason == reason
+        assert exc.message == message
 
     def test_response(self):
         method = 'GET'
@@ -105,13 +107,13 @@ class HTTPErrorTests(unittest.TestCase):
 
         response = exc.response()
 
-        self.assertEqual(response, expected_response)
+        assert response == expected_response
 
 
-class ConnectionErrorTests(unittest.TestCase):
+class TestConnectionError(object):
     """All tests for class ConnectionError."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc = FakedHmc('fake-hmc', '2.13.1', '1.8')
         self.cpc1 = self.hmc.cpcs.add({'name': 'cpc1'})
 
@@ -120,7 +122,7 @@ class ConnectionErrorTests(unittest.TestCase):
 
         exc = ConnectionError(msg)
 
-        self.assertEqual(exc.message, msg)
+        assert exc.message == msg
 
 
 class DummyHandler1(object):
@@ -135,7 +137,7 @@ class DummyHandler3(object):
     pass
 
 
-class InvalidResourceErrorTests(unittest.TestCase):
+class TestInvalidResourceError(object):
     """All tests for class InvalidResourceError."""
 
     def test_attributes_with_handler(self):
@@ -146,11 +148,11 @@ class InvalidResourceErrorTests(unittest.TestCase):
 
         exc = InvalidResourceError(method, uri, DummyHandler1)
 
-        self.assertEqual(exc.method, method)
-        self.assertEqual(exc.uri, uri)
-        self.assertEqual(exc.http_status, exp_http_status)
-        self.assertEqual(exc.reason, exp_reason)
-        self.assertIn(uri, exc.message)
+        assert exc.method == method
+        assert exc.uri == uri
+        assert exc.http_status == exp_http_status
+        assert exc.reason == exp_reason
+        assert uri in exc.message
 
         # next test case
         exp_reason = 2
@@ -158,7 +160,7 @@ class InvalidResourceErrorTests(unittest.TestCase):
         exc = InvalidResourceError(method, uri, DummyHandler1,
                                    reason=exp_reason)
 
-        self.assertEqual(exc.reason, exp_reason)
+        assert exc.reason == exp_reason
 
         # next test case
         exp_resource_uri = '/api/resource'
@@ -166,7 +168,7 @@ class InvalidResourceErrorTests(unittest.TestCase):
         exc = InvalidResourceError(method, uri, DummyHandler1,
                                    resource_uri=exp_resource_uri)
 
-        self.assertIn(exp_resource_uri, exc.message)
+        assert exp_resource_uri in exc.message
 
     def test_attributes_no_handler(self):
         method = 'GET'
@@ -176,13 +178,13 @@ class InvalidResourceErrorTests(unittest.TestCase):
 
         exc = InvalidResourceError(method, uri, None)
 
-        self.assertEqual(exc.method, method)
-        self.assertEqual(exc.uri, uri)
-        self.assertEqual(exc.http_status, exp_http_status)
-        self.assertEqual(exc.reason, exp_reason)
+        assert exc.method == method
+        assert exc.uri == uri
+        assert exc.http_status == exp_http_status
+        assert exc.reason == exp_reason
 
 
-class InvalidMethodErrorTests(unittest.TestCase):
+class TestInvalidMethodError(object):
     """All tests for class InvalidMethodError."""
 
     def test_attributes_with_handler(self):
@@ -193,10 +195,10 @@ class InvalidMethodErrorTests(unittest.TestCase):
 
         exc = InvalidMethodError(method, uri, DummyHandler1)
 
-        self.assertEqual(exc.method, method)
-        self.assertEqual(exc.uri, uri)
-        self.assertEqual(exc.http_status, exp_http_status)
-        self.assertEqual(exc.reason, exp_reason)
+        assert exc.method == method
+        assert exc.uri == uri
+        assert exc.http_status == exp_http_status
+        assert exc.reason == exp_reason
 
     def test_attributes_no_handler(self):
         method = 'DELETE'
@@ -206,16 +208,16 @@ class InvalidMethodErrorTests(unittest.TestCase):
 
         exc = InvalidMethodError(method, uri, None)
 
-        self.assertEqual(exc.method, method)
-        self.assertEqual(exc.uri, uri)
-        self.assertEqual(exc.http_status, exp_http_status)
-        self.assertEqual(exc.reason, exp_reason)
+        assert exc.method == method
+        assert exc.uri == uri
+        assert exc.http_status == exp_http_status
+        assert exc.reason == exp_reason
 
 
-class CpcNotInDpmErrorTests(unittest.TestCase):
+class TestCpcNotInDpmError(object):
     """All tests for class CpcNotInDpmError."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc = FakedHmc('fake-hmc', '2.13.1', '1.8')
         self.cpc1 = self.hmc.cpcs.add({'name': 'cpc1'})
 
@@ -227,16 +229,16 @@ class CpcNotInDpmErrorTests(unittest.TestCase):
 
         exc = CpcNotInDpmError(method, uri, self.cpc1)
 
-        self.assertEqual(exc.method, method)
-        self.assertEqual(exc.uri, uri)
-        self.assertEqual(exc.http_status, exp_http_status)
-        self.assertEqual(exc.reason, exp_reason)
+        assert exc.method == method
+        assert exc.uri == uri
+        assert exc.http_status == exp_http_status
+        assert exc.reason == exp_reason
 
 
-class CpcInDpmErrorTests(unittest.TestCase):
+class TestCpcInDpmError(object):
     """All tests for class CpcInDpmError."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc = FakedHmc('fake-hmc', '2.13.1', '1.8')
         self.cpc1 = self.hmc.cpcs.add({'name': 'cpc1'})
 
@@ -248,129 +250,129 @@ class CpcInDpmErrorTests(unittest.TestCase):
 
         exc = CpcInDpmError(method, uri, self.cpc1)
 
-        self.assertEqual(exc.method, method)
-        self.assertEqual(exc.uri, uri)
-        self.assertEqual(exc.http_status, exp_http_status)
-        self.assertEqual(exc.reason, exp_reason)
+        assert exc.method == method
+        assert exc.uri == uri
+        assert exc.http_status == exp_http_status
+        assert exc.reason == exp_reason
 
 
-class ParseQueryParmsTests(unittest.TestCase):
+class TestParseQueryParms(object):
     """All tests for parse_query_parms()."""
 
     def test_none(self):
         filter_args = parse_query_parms('fake-meth', 'fake-uri', None)
-        self.assertIsNone(filter_args)
+        assert filter_args is None
 
     def test_empty(self):
         filter_args = parse_query_parms('fake-meth', 'fake-uri', '')
-        self.assertIsNone(filter_args)
+        assert filter_args is None
 
     def test_one_normal(self):
         filter_args = parse_query_parms('fake-meth', 'fake-uri', 'a=b')
-        self.assertEqual(filter_args, {'a': 'b'})
+        assert filter_args == {'a': 'b'}
 
     def test_two_normal(self):
         filter_args = parse_query_parms('fake-meth', 'fake-uri', 'a=b&c=d')
-        self.assertEqual(filter_args, {'a': 'b', 'c': 'd'})
+        assert filter_args == {'a': 'b', 'c': 'd'}
 
     def test_one_trailing_amp(self):
         filter_args = parse_query_parms('fake-meth', 'fake-uri', 'a=b&')
-        self.assertEqual(filter_args, {'a': 'b'})
+        assert filter_args == {'a': 'b'}
 
     def test_one_leading_amp(self):
         filter_args = parse_query_parms('fake-meth', 'fake-uri', '&a=b')
-        self.assertEqual(filter_args, {'a': 'b'})
+        assert filter_args == {'a': 'b'}
 
     def test_one_missing_value(self):
         filter_args = parse_query_parms('fake-meth', 'fake-uri', 'a=')
-        self.assertEqual(filter_args, {'a': ''})
+        assert filter_args == {'a': ''}
 
     def test_one_missing_name(self):
         filter_args = parse_query_parms('fake-meth', 'fake-uri', '=b')
-        self.assertEqual(filter_args, {'': 'b'})
+        assert filter_args == {'': 'b'}
 
     def test_two_same_normal(self):
         filter_args = parse_query_parms('fake-meth', 'fake-uri', 'a=b&a=c')
-        self.assertEqual(filter_args, {'a': ['b', 'c']})
+        assert filter_args == {'a': ['b', 'c']}
 
     def test_two_same_one_normal(self):
         filter_args = parse_query_parms('fake-meth', 'fake-uri', 'a=b&d=e&a=c')
-        self.assertEqual(filter_args, {'a': ['b', 'c'], 'd': 'e'})
+        assert filter_args == {'a': ['b', 'c'], 'd': 'e'}
 
     def test_space_value_1(self):
         filter_args = parse_query_parms('fake-meth', 'fake-uri', 'a=b%20c')
-        self.assertEqual(filter_args, {'a': 'b c'})
+        assert filter_args == {'a': 'b c'}
 
     def test_space_value_2(self):
         filter_args = parse_query_parms('fake-meth', 'fake-uri', 'a=%20c')
-        self.assertEqual(filter_args, {'a': ' c'})
+        assert filter_args == {'a': ' c'}
 
     def test_space_value_3(self):
         filter_args = parse_query_parms('fake-meth', 'fake-uri', 'a=b%20')
-        self.assertEqual(filter_args, {'a': 'b '})
+        assert filter_args == {'a': 'b '}
 
     def test_space_value_4(self):
         filter_args = parse_query_parms('fake-meth', 'fake-uri', 'a=%20')
-        self.assertEqual(filter_args, {'a': ' '})
+        assert filter_args == {'a': ' '}
 
     def test_space_name_1(self):
         filter_args = parse_query_parms('fake-meth', 'fake-uri', 'a%20b=c')
-        self.assertEqual(filter_args, {'a b': 'c'})
+        assert filter_args == {'a b': 'c'}
 
     def test_space_name_2(self):
         filter_args = parse_query_parms('fake-meth', 'fake-uri', '%20b=c')
-        self.assertEqual(filter_args, {' b': 'c'})
+        assert filter_args == {' b': 'c'}
 
     def test_space_name_3(self):
         filter_args = parse_query_parms('fake-meth', 'fake-uri', 'a%20=c')
-        self.assertEqual(filter_args, {'a ': 'c'})
+        assert filter_args == {'a ': 'c'}
 
     def test_space_name_4(self):
         filter_args = parse_query_parms('fake-meth', 'fake-uri', '%20=c')
-        self.assertEqual(filter_args, {' ': 'c'})
+        assert filter_args == {' ': 'c'}
 
     def test_invalid_format_1(self):
-        with self.assertRaises(HTTPError) as cm:
+        with pytest.raises(HTTPError) as exc_info:
             parse_query_parms('fake-meth', 'fake-uri', 'a==b')
-        exc = cm.exception
-        self.assertEqual(exc.http_status, 400)
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.http_status == 400
+        assert exc.reason == 1
 
     def test_invalid_format_2(self):
-        with self.assertRaises(HTTPError) as cm:
+        with pytest.raises(HTTPError) as exc_info:
             parse_query_parms('fake-meth', 'fake-uri', 'a=b=c')
-        exc = cm.exception
-        self.assertEqual(exc.http_status, 400)
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.http_status == 400
+        assert exc.reason == 1
 
     def test_invalid_format_3(self):
-        with self.assertRaises(HTTPError) as cm:
+        with pytest.raises(HTTPError) as exc_info:
             parse_query_parms('fake-meth', 'fake-uri', 'a')
-        exc = cm.exception
-        self.assertEqual(exc.http_status, 400)
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.http_status == 400
+        assert exc.reason == 1
 
 
-class UriHandlerHandlerEmptyTests(unittest.TestCase):
+class TestUriHandlerHandlerEmpty(object):
     """All tests for UriHandler.handler() with empty URIs."""
 
-    def setUp(self):
+    def setup_method(self):
         self.uris = ()
         self.urihandler = UriHandler(self.uris)
 
     def test_uris_empty_1(self):
-        with self.assertRaises(InvalidResourceError):
+        with pytest.raises(InvalidResourceError):
             self.urihandler.handler('/api/cpcs', 'GET')
 
     def test_uris_empty_2(self):
-        with self.assertRaises(InvalidResourceError):
+        with pytest.raises(InvalidResourceError):
             self.urihandler.handler('', 'GET')
 
 
-class UriHandlerHandlerSimpleTests(unittest.TestCase):
+class TestUriHandlerHandlerSimple(object):
     """All tests for UriHandler.handler() with a simple set of URIs."""
 
-    def setUp(self):
+    def setup_method(self):
         self.uris = (
             (r'/api/cpcs', DummyHandler1),
             (r'/api/cpcs/([^/]+)', DummyHandler2),
@@ -381,60 +383,60 @@ class UriHandlerHandlerSimpleTests(unittest.TestCase):
     def test_ok1(self):
         handler_class, uri_parms = self.urihandler.handler(
             '/api/cpcs', 'GET')
-        self.assertEqual(handler_class, DummyHandler1)
-        self.assertEqual(len(uri_parms), 0)
+        assert handler_class == DummyHandler1
+        assert len(uri_parms) == 0
 
     def test_ok2(self):
         handler_class, uri_parms = self.urihandler.handler(
             '/api/cpcs/fake-id1', 'GET')
-        self.assertEqual(handler_class, DummyHandler2)
-        self.assertEqual(len(uri_parms), 1)
-        self.assertEqual(uri_parms[0], 'fake-id1')
+        assert handler_class == DummyHandler2
+        assert len(uri_parms) == 1
+        assert uri_parms[0] == 'fake-id1'
 
     def test_ok3(self):
         handler_class, uri_parms = self.urihandler.handler(
             '/api/cpcs/fake-id1/child', 'GET')
-        self.assertEqual(handler_class, DummyHandler3)
-        self.assertEqual(len(uri_parms), 1)
-        self.assertEqual(uri_parms[0], 'fake-id1')
+        assert handler_class == DummyHandler3
+        assert len(uri_parms) == 1
+        assert uri_parms[0] == 'fake-id1'
 
     def test_err_begin_missing(self):
-        with self.assertRaises(InvalidResourceError):
+        with pytest.raises(InvalidResourceError):
             self.urihandler.handler('api/cpcs', 'GET')
 
     def test_err_begin_extra(self):
-        with self.assertRaises(InvalidResourceError):
+        with pytest.raises(InvalidResourceError):
             self.urihandler.handler('x/api/cpcs', 'GET')
 
     def test_err_end_missing(self):
-        with self.assertRaises(InvalidResourceError):
+        with pytest.raises(InvalidResourceError):
             self.urihandler.handler('/api/cpc', 'GET')
 
     def test_err_end_extra(self):
-        with self.assertRaises(InvalidResourceError):
+        with pytest.raises(InvalidResourceError):
             self.urihandler.handler('/api/cpcs_x', 'GET')
 
     def test_err_end_slash(self):
-        with self.assertRaises(InvalidResourceError):
+        with pytest.raises(InvalidResourceError):
             self.urihandler.handler('/api/cpcs/', 'GET')
 
     def test_err_end2_slash(self):
-        with self.assertRaises(InvalidResourceError):
+        with pytest.raises(InvalidResourceError):
             self.urihandler.handler('/api/cpcs/fake-id1/', 'GET')
 
     def test_err_end2_missing(self):
-        with self.assertRaises(InvalidResourceError):
+        with pytest.raises(InvalidResourceError):
             self.urihandler.handler('/api/cpcs/fake-id1/chil', 'GET')
 
     def test_err_end2_extra(self):
-        with self.assertRaises(InvalidResourceError):
+        with pytest.raises(InvalidResourceError):
             self.urihandler.handler('/api/cpcs/fake-id1/child_x', 'GET')
 
 
-class UriHandlerMethodTests(unittest.TestCase):
+class TestUriHandlerMethod(object):
     """All tests for get(), post(), delete() methods of class UriHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.uris = (
             (r'/api/cpcs', DummyHandler1),
             (r'/api/cpcs/([^/]+)', DummyHandler2),
@@ -468,7 +470,7 @@ class UriHandlerMethodTests(unittest.TestCase):
         self.urihandler = UriHandler(self.uris)
         self.hmc = FakedHmc('fake-hmc', '2.13.1', '1.8')
 
-    def tearDown(self):
+    def teardown_method(self):
         delattr(DummyHandler1, 'get')
         delattr(DummyHandler1, 'post')
         delattr(DummyHandler2, 'get')
@@ -479,48 +481,48 @@ class UriHandlerMethodTests(unittest.TestCase):
         # the function to be tested
         result = self.urihandler.get(self.hmc, '/api/cpcs', True)
 
-        self.assertEqual(result, self.cpcs)
+        assert result == self.cpcs
 
         DummyHandler1.get.assert_called_with(
             'GET', self.hmc, '/api/cpcs', tuple(), True)
-        self.assertEqual(DummyHandler1.post.called, 0)
-        self.assertEqual(DummyHandler2.get.called, 0)
-        self.assertEqual(DummyHandler2.delete.called, 0)
+        assert DummyHandler1.post.called == 0
+        assert DummyHandler2.get.called == 0
+        assert DummyHandler2.delete.called == 0
 
     def test_get_cpc1(self):
 
         # the function to be tested
         result = self.urihandler.get(self.hmc, '/api/cpcs/1', True)
 
-        self.assertEqual(result, self.cpc1)
+        assert result == self.cpc1
 
-        self.assertEqual(DummyHandler1.get.called, 0)
-        self.assertEqual(DummyHandler1.post.called, 0)
+        assert DummyHandler1.get.called == 0
+        assert DummyHandler1.post.called == 0
         DummyHandler2.get.assert_called_with(
             'GET', self.hmc, '/api/cpcs/1', tuple('1'), True)
-        self.assertEqual(DummyHandler2.delete.called, 0)
+        assert DummyHandler2.delete.called == 0
 
     def test_post_cpcs(self):
 
         # the function to be tested
         result = self.urihandler.post(self.hmc, '/api/cpcs', {}, True, True)
 
-        self.assertEqual(result, self.new_cpc)
+        assert result == self.new_cpc
 
-        self.assertEqual(DummyHandler1.get.called, 0)
+        assert DummyHandler1.get.called == 0
         DummyHandler1.post.assert_called_with(
             'POST', self.hmc, '/api/cpcs', tuple(), {}, True, True)
-        self.assertEqual(DummyHandler2.get.called, 0)
-        self.assertEqual(DummyHandler2.delete.called, 0)
+        assert DummyHandler2.get.called == 0
+        assert DummyHandler2.delete.called == 0
 
     def test_delete_cpc2(self):
 
         # the function to be tested
         self.urihandler.delete(self.hmc, '/api/cpcs/2', True)
 
-        self.assertEqual(DummyHandler1.get.called, 0)
-        self.assertEqual(DummyHandler1.post.called, 0)
-        self.assertEqual(DummyHandler2.get.called, 0)
+        assert DummyHandler1.get.called == 0
+        assert DummyHandler1.post.called == 0
+        assert DummyHandler2.get.called == 0
         DummyHandler2.delete.assert_called_with(
             'DELETE', self.hmc, '/api/cpcs/2', tuple('2'), True)
 
@@ -815,10 +817,10 @@ def standard_test_hmc():
     return hmc, hmc_resources
 
 
-class GenericGetPropertiesHandlerTests(unittest.TestCase):
+class TestGenericGetPropertiesHandler(object):
     """All tests for class GenericGetPropertiesHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/cpcs/([^/]+)', GenericGetPropertiesHandler),
@@ -839,13 +841,13 @@ class GenericGetPropertiesHandlerTests(unittest.TestCase):
             'description': 'CPC #1 (classic mode)',
             'status': 'operating',
         }
-        self.assertEqual(cpc1, exp_cpc1)
+        assert cpc1 == exp_cpc1
 
     def test_get_error_offline(self):
 
         self.hmc.disable()
 
-        with self.assertRaises(ConnectionError):
+        with pytest.raises(ConnectionError):
             # the function to be tested:
             self.urihandler.get(self.hmc, '/api/cpcs/1', True)
 
@@ -855,10 +857,10 @@ class _GenericGetUpdatePropertiesHandler(GenericGetPropertiesHandler,
     pass
 
 
-class GenericUpdatePropertiesHandlerTests(unittest.TestCase):
+class TestGenericUpdatePropertiesHandler(object):
     """All tests for class GenericUpdatePropertiesHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/cpcs/([^/]+)', _GenericGetUpdatePropertiesHandler),
@@ -874,9 +876,9 @@ class GenericUpdatePropertiesHandlerTests(unittest.TestCase):
         resp = self.urihandler.post(self.hmc, '/api/cpcs/1', update_cpc1, True,
                                     True)
 
-        self.assertEqual(resp, None)
+        assert resp is None
         cpc1 = self.urihandler.get(self.hmc, '/api/cpcs/1', True)
-        self.assertEqual(cpc1['description'], 'CPC #1 (updated)')
+        assert cpc1['description'] == 'CPC #1 (updated)'
 
     def test_post_error_offline(self):
 
@@ -886,16 +888,16 @@ class GenericUpdatePropertiesHandlerTests(unittest.TestCase):
             'description': 'CPC #1 (updated)',
         }
 
-        with self.assertRaises(ConnectionError):
+        with pytest.raises(ConnectionError):
             # the function to be tested:
             self.urihandler.post(self.hmc, '/api/cpcs/1', update_cpc1, True,
                                  True)
 
 
-class GenericDeleteHandlerTests(unittest.TestCase):
+class TestGenericDeleteHandler(object):
     """All tests for class GenericDeleteHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             ('/api/console/ldap-server-definitions/([^/]+)',
@@ -910,10 +912,10 @@ class GenericDeleteHandlerTests(unittest.TestCase):
         # the function to be tested:
         ret = self.urihandler.delete(self.hmc, uri, True)
 
-        self.assertIsNone(ret)
+        assert ret is None
 
         # Verify it no longer exists:
-        with self.assertRaises(KeyError):
+        with pytest.raises(KeyError):
             self.hmc.lookup_by_uri(uri)
 
     def test_delete_error_offline(self):
@@ -922,15 +924,15 @@ class GenericDeleteHandlerTests(unittest.TestCase):
 
         uri = '/api/console/ldap-server-definitions/fake-ldap-srv-def-oid-1'
 
-        with self.assertRaises(ConnectionError):
+        with pytest.raises(ConnectionError):
             # the function to be tested:
             self.urihandler.delete(self.hmc, uri, True)
 
 
-class VersionHandlerTests(unittest.TestCase):
+class TestVersionHandler(object):
     """All tests for class VersionHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/version', VersionHandler),
@@ -949,13 +951,13 @@ class VersionHandlerTests(unittest.TestCase):
             'api-major-version': int(api_major),
             'api-minor-version': int(api_minor),
         }
-        self.assertEqual(resp, exp_resp)
+        assert resp == exp_resp
 
 
-class ConsoleHandlerTests(unittest.TestCase):
+class TestConsoleHandler(object):
     """All tests for class ConsoleHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
 
         self.uris = (
@@ -975,13 +977,13 @@ class ConsoleHandlerTests(unittest.TestCase):
             'object-uri': '/api/console',
             'name': 'fake_console_name',
         }
-        self.assertEqual(console, exp_console)
+        assert console == exp_console
 
 
-class ConsoleRestartHandlerTests(unittest.TestCase):
+class TestConsoleRestartHandler(object):
     """All tests for class ConsoleRestartHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
 
         self.uris = (
@@ -999,8 +1001,8 @@ class ConsoleRestartHandlerTests(unittest.TestCase):
         resp = self.urihandler.post(
             self.hmc, '/api/console/operations/restart', body, True, True)
 
-        self.assertTrue(self.hmc.enabled)
-        self.assertIsNone(resp)
+        assert self.hmc.enabled
+        assert resp is None
 
     def test_restart_error_not_found(self):
 
@@ -1010,20 +1012,20 @@ class ConsoleRestartHandlerTests(unittest.TestCase):
         body = {
             'force': False,
         }
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.post(
                 self.hmc, '/api/console/operations/restart', body, True, True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
 
-class ConsoleShutdownHandlerTests(unittest.TestCase):
+class TestConsoleShutdownHandler(object):
     """All tests for class ConsoleShutdownHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
 
         self.uris = (
@@ -1041,8 +1043,8 @@ class ConsoleShutdownHandlerTests(unittest.TestCase):
         resp = self.urihandler.post(
             self.hmc, '/api/console/operations/shutdown', body, True, True)
 
-        self.assertFalse(self.hmc.enabled)
-        self.assertIsNone(resp)
+        assert not self.hmc.enabled
+        assert resp is None
 
     def test_shutdown_error_not_found(self):
 
@@ -1052,20 +1054,20 @@ class ConsoleShutdownHandlerTests(unittest.TestCase):
         body = {
             'force': False,
         }
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.post(
                 self.hmc, '/api/console/operations/shutdown', body, True, True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
 
-class ConsoleMakePrimaryHandlerTests(unittest.TestCase):
+class TestConsoleMakePrimaryHandler(object):
     """All tests for class ConsoleMakePrimaryHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
 
         self.uris = (
@@ -1081,8 +1083,8 @@ class ConsoleMakePrimaryHandlerTests(unittest.TestCase):
         resp = self.urihandler.post(
             self.hmc, '/api/console/operations/make-primary', None, True, True)
 
-        self.assertTrue(self.hmc.enabled)
-        self.assertIsNone(resp)
+        assert self.hmc.enabled
+        assert resp is None
 
     def test_make_primary_error_not_found(self):
 
@@ -1092,21 +1094,21 @@ class ConsoleMakePrimaryHandlerTests(unittest.TestCase):
         body = {
             'force': False,
         }
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.post(
                 self.hmc, '/api/console/operations/make-primary', body, True,
                 True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
 
-class ConsoleReorderUserPatternsHandlerTests(unittest.TestCase):
+class TestConsoleReorderUserPatternsHandler(object):
     """All tests for class ConsoleReorderUserPatternsHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
 
         # Remove the standard User Pattern objects for this test
@@ -1172,7 +1174,7 @@ class ConsoleReorderUserPatternsHandlerTests(unittest.TestCase):
         act_uris = [up['element-uri'] for up in act_user_patterns]
 
         # Verify that the actual order is the new (expected) order:
-        self.assertEqual(act_uris, new_uris)
+        assert act_uris == new_uris
 
     def test_reorder_error_not_found(self):
 
@@ -1182,7 +1184,7 @@ class ConsoleReorderUserPatternsHandlerTests(unittest.TestCase):
         body = {
             'user-pattern-uris': []
         }
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
 
@@ -1190,14 +1192,14 @@ class ConsoleReorderUserPatternsHandlerTests(unittest.TestCase):
                 self.hmc, '/api/console/operations/reorder-user-patterns',
                 body, True, True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
 
-class ConsoleGetAuditLogHandlerTests(unittest.TestCase):
+class TestConsoleGetAuditLogHandler(object):
     """All tests for class ConsoleGetAuditLogHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
 
         self.uris = (
@@ -1214,7 +1216,7 @@ class ConsoleGetAuditLogHandlerTests(unittest.TestCase):
             self.hmc, '/api/console/operations/get-audit-log', None, True,
             True)
 
-        self.assertEqual(resp, [])
+        assert resp == []
 
     # TODO: Add testcases with non-empty audit log (once supported in mock)
 
@@ -1223,21 +1225,21 @@ class ConsoleGetAuditLogHandlerTests(unittest.TestCase):
         # Remove the faked Console object
         self.hmc.consoles.remove(None)
 
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.post(
                 self.hmc, '/api/console/operations/get-audit-log', None, True,
                 True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
 
-class ConsoleGetSecurityLogHandlerTests(unittest.TestCase):
+class TestConsoleGetSecurityLogHandler(object):
     """All tests for class ConsoleGetSecurityLogHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
 
         self.uris = (
@@ -1254,7 +1256,7 @@ class ConsoleGetSecurityLogHandlerTests(unittest.TestCase):
             self.hmc, '/api/console/operations/get-security-log', None, True,
             True)
 
-        self.assertEqual(resp, [])
+        assert resp == []
 
     # TODO: Add testcases with non-empty security log (once supported in mock)
 
@@ -1263,21 +1265,21 @@ class ConsoleGetSecurityLogHandlerTests(unittest.TestCase):
         # Remove the faked Console object
         self.hmc.consoles.remove(None)
 
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.post(
                 self.hmc, '/api/console/operations/get-security-log', None,
                 True, True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
 
-class ConsoleListUnmanagedCpcsHandlerTests(unittest.TestCase):
+class TestConsoleListUnmanagedCpcsHandler(object):
     """All tests for class ConsoleListUnmanagedCpcsHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
 
         self.uris = (
@@ -1294,7 +1296,7 @@ class ConsoleListUnmanagedCpcsHandlerTests(unittest.TestCase):
             self.hmc, '/api/console/operations/list-unmanaged-cpcs', True)
 
         cpcs = resp['cpcs']
-        self.assertEqual(cpcs, [])
+        assert cpcs == []
 
     # TODO: Add testcases for non-empty list of unmanaged CPCs
 
@@ -1303,20 +1305,20 @@ class ConsoleListUnmanagedCpcsHandlerTests(unittest.TestCase):
         # Remove the faked Console object
         self.hmc.consoles.remove(None)
 
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.get(
                 self.hmc, '/api/console/operations/list-unmanaged-cpcs', True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
 
-class UserHandlersTests(unittest.TestCase):
+class TestUserHandlers(object):
     """All tests for classes UsersHandler and UserHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
 
         self.uris = (
@@ -1339,20 +1341,20 @@ class UserHandlersTests(unittest.TestCase):
                 },
             ]
         }
-        self.assertEqual(users, exp_users)
+        assert users == exp_users
 
     def test_list_error_console_not_found(self):
 
         # Remove the faked Console object
         self.hmc.consoles.remove(None)
 
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.get(self.hmc, '/api/console/users', True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
     def test_get(self):
 
@@ -1367,7 +1369,7 @@ class UserHandlersTests(unittest.TestCase):
             'description': 'User #1',
             'type': 'system-defined',
         }
-        self.assertEqual(user1, exp_user1)
+        assert user1 == exp_user1
 
     def test_create_verify(self):
         new_user2 = {
@@ -1382,10 +1384,10 @@ class UserHandlersTests(unittest.TestCase):
         resp = self.urihandler.post(self.hmc, '/api/console/users',
                                     new_user2, True, True)
 
-        self.assertEqual(len(resp), 1)
-        self.assertIn('object-uri', resp)
+        assert len(resp) == 1
+        assert 'object-uri' in resp
         new_user2_uri = resp['object-uri']
-        self.assertEqual(new_user2_uri, '/api/users/2')
+        assert new_user2_uri == '/api/users/2'
 
         exp_user2 = {
             'object-id': '2',
@@ -1399,7 +1401,7 @@ class UserHandlersTests(unittest.TestCase):
         # the function to be tested:
         user2 = self.urihandler.get(self.hmc, '/api/users/2', True)
 
-        self.assertEqual(user2, exp_user2)
+        assert user2 == exp_user2
 
     def test_create_error_console_not_found(self):
 
@@ -1414,14 +1416,14 @@ class UserHandlersTests(unittest.TestCase):
             'authentication-type': 'local',
         }
 
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.post(self.hmc, '/api/console/users', new_user2,
                                  True, True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
     def test_update_verify(self):
         update_user1 = {
@@ -1434,7 +1436,7 @@ class UserHandlersTests(unittest.TestCase):
 
         user1 = self.urihandler.get(self.hmc, '/api/users/fake-user-oid-1',
                                     True)
-        self.assertEqual(user1['description'], 'updated user #1')
+        assert user1['description'] == 'updated user #1'
 
     def test_delete_verify_all(self):
         testcases = [
@@ -1478,12 +1480,12 @@ class UserHandlersTests(unittest.TestCase):
 
         if exp_exc_tuple is not None:
 
-            with self.assertRaises(HTTPError) as cm:
+            with pytest.raises(HTTPError) as exc_info:
 
                 # Execute the code to be tested
                 self.urihandler.delete(self.hmc, user_uri, True)
 
-            exc = cm.exception
+            exc = exc_info.value
             assert exc.http_status == exp_exc_tuple[0]
             assert exc.reason == exp_exc_tuple[1]
 
@@ -1496,14 +1498,14 @@ class UserHandlersTests(unittest.TestCase):
             self.urihandler.delete(self.hmc, user_uri, True)
 
             # Verify that it has been deleted
-            with self.assertRaises(InvalidResourceError):
+            with pytest.raises(InvalidResourceError):
                 self.urihandler.get(self.hmc, user_uri, True)
 
 
-class UserAddUserRoleHandlerTests(unittest.TestCase):
+class TestUserAddUserRoleHandler(object):
     """All tests for class UserAddUserRoleHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         # Has a system-defined User (oid=fake-user-oid-1)
         # Has a system-defined User Role (oid=fake-user-role-oid-1)
@@ -1553,13 +1555,13 @@ class UserAddUserRoleHandlerTests(unittest.TestCase):
         # the function to be tested:
         resp = self.urihandler.post(self.hmc, uri, input_parms, True, True)
 
-        self.assertIsNone(resp)
+        assert resp is None
         user2_props = self.urihandler.get(self.hmc, self.user2_uri, True)
-        self.assertTrue('user-roles' in user2_props)
+        assert 'user-roles' in user2_props
         user_roles = user2_props['user-roles']
-        self.assertEqual(len(user_roles), 1)
+        assert len(user_roles) == 1
         user_role_uri = user_roles[0]
-        self.assertEqual(user_role_uri, self.user_role2_uri)
+        assert user_role_uri == self.user_role2_uri
 
     def test_add_error_bad_user(self):
         """Test failed addition of a user role to a bad user."""
@@ -1581,13 +1583,13 @@ class UserAddUserRoleHandlerTests(unittest.TestCase):
         input_parms = {
             'user-role-uri': self.user_role2_uri
         }
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.post(self.hmc, uri, input_parms, True, True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
     # TODO: Add testcase for adding to system-defined or pattern-based user
 
@@ -1613,19 +1615,19 @@ class UserAddUserRoleHandlerTests(unittest.TestCase):
         input_parms = {
             'user-role-uri': bad_user_role_uri
         }
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.post(self.hmc, uri, input_parms, True, True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 2)
+        exc = exc_info.value
+        assert exc.reason == 2
 
 
-class UserRemoveUserRoleHandlerTests(unittest.TestCase):
+class TestUserRemoveUserRoleHandler(object):
     """All tests for class UserRemoveUserRoleHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         # Has a system-defined User (oid=fake-user-oid-1)
         # Has a system-defined User Role (oid=fake-user-role-oid-1)
@@ -1684,11 +1686,11 @@ class UserRemoveUserRoleHandlerTests(unittest.TestCase):
         # the function to be tested:
         resp = self.urihandler.post(self.hmc, uri, input_parms, True, True)
 
-        self.assertIsNone(resp)
+        assert resp is None
         user2_props = self.urihandler.get(self.hmc, self.user2_uri, True)
-        self.assertTrue('user-roles' in user2_props)
+        assert 'user-roles' in user2_props
         user_roles = user2_props['user-roles']
-        self.assertEqual(len(user_roles), 0)
+        assert len(user_roles) == 0
 
     def test_remove_error_bad_user(self):
         """Test failed removal of a user role from a bad user."""
@@ -1710,13 +1712,13 @@ class UserRemoveUserRoleHandlerTests(unittest.TestCase):
         input_parms = {
             'user-role-uri': self.user_role2_uri
         }
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.post(self.hmc, uri, input_parms, True, True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
     # TODO: Add testcase for removing from system-defined or pattern-based user
 
@@ -1742,13 +1744,13 @@ class UserRemoveUserRoleHandlerTests(unittest.TestCase):
         input_parms = {
             'user-role-uri': bad_user_role_uri
         }
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.post(self.hmc, uri, input_parms, True, True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 2)
+        exc = exc_info.value
+        assert exc.reason == 2
 
     def test_remove_error_no_user_role(self):
         """Test failed removal of a user role that a user does not have."""
@@ -1783,19 +1785,19 @@ class UserRemoveUserRoleHandlerTests(unittest.TestCase):
         input_parms = {
             'user-role-uri': self.user_role2_uri
         }
-        with self.assertRaises(ConflictError) as cm:
+        with pytest.raises(ConflictError) as exc_info:
 
             # the function to be tested:
             self.urihandler.post(self.hmc, uri, input_parms, True, True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 316)
+        exc = exc_info.value
+        assert exc.reason == 316
 
 
-class UserRoleHandlersTests(unittest.TestCase):
+class TestUserRoleHandlers(object):
     """All tests for classes UserRolesHandler and UserRoleHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
 
         self.uris = (
@@ -1819,20 +1821,20 @@ class UserRoleHandlersTests(unittest.TestCase):
                 },
             ]
         }
-        self.assertEqual(user_roles, exp_user_roles)
+        assert user_roles == exp_user_roles
 
     def test_list_error_console_not_found(self):
 
         # Remove the faked Console object
         self.hmc.consoles.remove(None)
 
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.get(self.hmc, '/api/console/user-roles', True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
     def test_get(self):
 
@@ -1847,7 +1849,7 @@ class UserRoleHandlersTests(unittest.TestCase):
             'description': 'User Role #1',
             'type': 'system-defined',
         }
-        self.assertEqual(user_role1, exp_user_role1)
+        assert user_role1 == exp_user_role1
 
     def test_create_verify(self):
         new_user_role2 = {
@@ -1859,14 +1861,14 @@ class UserRoleHandlersTests(unittest.TestCase):
         resp = self.urihandler.post(
             self.hmc, '/api/console/user-roles', new_user_role2, True, True)
 
-        self.assertEqual(len(resp), 1)
-        self.assertIn('object-uri', resp)
+        assert len(resp) == 1
+        assert 'object-uri' in resp
         new_user_role2_uri = resp['object-uri']
 
         # the function to be tested:
         user_role2 = self.urihandler.get(self.hmc, new_user_role2_uri, True)
 
-        self.assertEqual(user_role2['type'], 'user-defined')
+        assert user_role2['type'] == 'user-defined'
 
     def test_create_error_console_not_found(self):
 
@@ -1878,14 +1880,14 @@ class UserRoleHandlersTests(unittest.TestCase):
             'description': 'User Role #2',
         }
 
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.post(self.hmc, '/api/console/user-roles',
                                  new_user_role2, True, True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
     def test_create_error_type(self):
 
@@ -1895,14 +1897,14 @@ class UserRoleHandlersTests(unittest.TestCase):
             'type': 'user-defined',  # error: type is implied
         }
 
-        with self.assertRaises(BadRequestError) as cm:
+        with pytest.raises(BadRequestError) as exc_info:
 
             # the function to be tested:
             self.urihandler.post(self.hmc, '/api/console/user-roles',
                                  new_user_role2, True, True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 6)
+        exc = exc_info.value
+        assert exc.reason == 6
 
     def test_update_verify(self):
         update_user_role1 = {
@@ -1916,7 +1918,7 @@ class UserRoleHandlersTests(unittest.TestCase):
 
         user_role1 = self.urihandler.get(
             self.hmc, '/api/user-roles/fake-user-role-oid-1', True)
-        self.assertEqual(user_role1['description'], 'updated user #1')
+        assert user_role1['description'] == 'updated user #1'
 
     def test_delete_verify(self):
 
@@ -1938,14 +1940,14 @@ class UserRoleHandlersTests(unittest.TestCase):
         self.urihandler.delete(self.hmc, new_user_role2_uri, True)
 
         # Verify that it has been deleted
-        with self.assertRaises(InvalidResourceError):
+        with pytest.raises(InvalidResourceError):
             self.urihandler.get(self.hmc, new_user_role2_uri, True)
 
 
-class UserRoleAddPermissionHandlerTests(unittest.TestCase):
+class TestUserRoleAddPermissionHandler(object):
     """All tests for class UserRoleAddPermissionHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         # Has a system-defined User Role (oid=fake-user-role-oid-1)
 
@@ -2010,13 +2012,13 @@ class UserRoleAddPermissionHandlerTests(unittest.TestCase):
         resp = self.urihandler.post(
             self.hmc, uri, input_permission, True, True)
 
-        self.assertIsNone(resp)
+        assert resp is None
         props = self.urihandler.get(self.hmc, self.user_role2_uri, True)
-        self.assertTrue('permissions' in props)
+        assert 'permissions' in props
         permissions = props['permissions']
-        self.assertEqual(len(permissions), 1)
+        assert len(permissions) == 1
         perm = permissions[0]
-        self.assertEqual(perm, exp_permission)
+        assert perm == exp_permission
 
     def test_add_error_bad_user_role(self):
         """Test failed addition of a permission to a bad User Role."""
@@ -2030,13 +2032,13 @@ class UserRoleAddPermissionHandlerTests(unittest.TestCase):
             'include-members': True,
             'view-only-mode': False,
         }
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.post(self.hmc, uri, input_parms, True, True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
     def test_add_error_system_user_role(self):
         """Test failed addition of a permission to a system-defined User
@@ -2051,19 +2053,19 @@ class UserRoleAddPermissionHandlerTests(unittest.TestCase):
             'include-members': True,
             'view-only-mode': False,
         }
-        with self.assertRaises(BadRequestError) as cm:
+        with pytest.raises(BadRequestError) as exc_info:
 
             # the function to be tested:
             self.urihandler.post(self.hmc, uri, input_parms, True, True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 314)
+        exc = exc_info.value
+        assert exc.reason == 314
 
 
-class UserRoleRemovePermissionHandlerTests(unittest.TestCase):
+class TestUserRoleRemovePermissionHandler(object):
     """All tests for class UserRoleRemovePermissionHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         # Has a system-defined User Role (oid=fake-user-role-oid-1)
 
@@ -2135,11 +2137,11 @@ class UserRoleRemovePermissionHandlerTests(unittest.TestCase):
         resp = self.urihandler.post(
             self.hmc, uri, input_permission, True, True)
 
-        self.assertIsNone(resp)
+        assert resp is None
         props = self.urihandler.get(self.hmc, self.user_role2_uri, True)
-        self.assertTrue('permissions' in props)
+        assert 'permissions' in props
         permissions = props['permissions']
-        self.assertEqual(len(permissions), 0)
+        assert len(permissions) == 0
 
     def test_remove_error_bad_user_role(self):
         """Test failed removal of a permission from a bad User Role."""
@@ -2153,13 +2155,13 @@ class UserRoleRemovePermissionHandlerTests(unittest.TestCase):
             'include-members': True,
             'view-only-mode': False,
         }
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.post(self.hmc, uri, input_parms, True, True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
     def test_remove_error_system_user_role(self):
         """Test failed removal of a permission from a system-defined User
@@ -2174,19 +2176,19 @@ class UserRoleRemovePermissionHandlerTests(unittest.TestCase):
             'include-members': True,
             'view-only-mode': False,
         }
-        with self.assertRaises(BadRequestError) as cm:
+        with pytest.raises(BadRequestError) as exc_info:
 
             # the function to be tested:
             self.urihandler.post(self.hmc, uri, input_parms, True, True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 314)
+        exc = exc_info.value
+        assert exc.reason == 314
 
 
-class TaskHandlersTests(unittest.TestCase):
+class TestTaskHandlers(object):
     """All tests for classes TasksHandler and TaskHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
 
         self.uris = (
@@ -2212,20 +2214,20 @@ class TaskHandlersTests(unittest.TestCase):
                 },
             ]
         }
-        self.assertEqual(tasks, exp_tasks)
+        assert tasks == exp_tasks
 
     def test_list_error_console_not_found(self):
 
         # Remove the faked Console object
         self.hmc.consoles.remove(None)
 
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.get(self.hmc, '/api/console/tasks', True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
     def test_get(self):
 
@@ -2239,13 +2241,13 @@ class TaskHandlersTests(unittest.TestCase):
             'name': 'fake_task_name_1',
             'description': 'Task #1',
         }
-        self.assertEqual(task1, exp_task1)
+        assert task1 == exp_task1
 
 
-class UserPatternHandlersTests(unittest.TestCase):
+class TestUserPatternHandlers(object):
     """All tests for classes UserPatternsHandler and UserPatternHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
 
         self.uris = (
@@ -2270,20 +2272,20 @@ class UserPatternHandlersTests(unittest.TestCase):
                 },
             ]
         }
-        self.assertEqual(user_patterns, exp_user_patterns)
+        assert user_patterns == exp_user_patterns
 
     def test_list_error_console_not_found(self):
 
         # Remove the faked Console object
         self.hmc.consoles.remove(None)
 
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.get(self.hmc, '/api/console/user-patterns', True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
     def test_get(self):
 
@@ -2303,7 +2305,7 @@ class UserPatternHandlersTests(unittest.TestCase):
             'retention-time': 0,
             'user-template-uri': '/api/users/fake-user-oid-1',
         }
-        self.assertEqual(user_pattern1, exp_user_pattern1)
+        assert user_pattern1 == exp_user_pattern1
 
     def test_create_verify(self):
         new_user_pattern_input = {
@@ -2320,8 +2322,8 @@ class UserPatternHandlersTests(unittest.TestCase):
             self.hmc, '/api/console/user-patterns', new_user_pattern_input,
             True, True)
 
-        self.assertEqual(len(resp), 1)
-        self.assertIn('element-uri', resp)
+        assert len(resp) == 1
+        assert 'element-uri' in resp
         new_user_pattern_uri = resp['element-uri']
 
         # the function to be tested:
@@ -2330,7 +2332,7 @@ class UserPatternHandlersTests(unittest.TestCase):
 
         new_name = new_user_pattern['name']
         input_name = new_user_pattern_input['name']
-        self.assertEqual(new_name, input_name)
+        assert new_name == input_name
 
     def test_create_error_console_not_found(self):
 
@@ -2342,14 +2344,14 @@ class UserPatternHandlersTests(unittest.TestCase):
             'description': 'User Pattern #X',
         }
 
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.post(self.hmc, '/api/console/user-patterns',
                                  new_user_pattern_input, True, True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
     def test_update_verify(self):
         update_user_pattern1 = {
@@ -2364,8 +2366,7 @@ class UserPatternHandlersTests(unittest.TestCase):
         user_pattern1 = self.urihandler.get(
             self.hmc, '/api/console/user-patterns/fake-user-pattern-oid-1',
             True)
-        self.assertEqual(user_pattern1['description'],
-                         'updated user pattern #1')
+        assert user_pattern1['description'] == 'updated user pattern #1'
 
     def test_delete_verify(self):
 
@@ -2392,14 +2393,14 @@ class UserPatternHandlersTests(unittest.TestCase):
         self.urihandler.delete(self.hmc, new_user_pattern_uri, True)
 
         # Verify that it has been deleted
-        with self.assertRaises(InvalidResourceError):
+        with pytest.raises(InvalidResourceError):
             self.urihandler.get(self.hmc, new_user_pattern_uri, True)
 
 
-class PasswordRuleHandlersTests(unittest.TestCase):
+class TestPasswordRuleHandlers(object):
     """All tests for classes PasswordRulesHandler and PasswordRuleHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
 
         self.uris = (
@@ -2424,20 +2425,20 @@ class PasswordRuleHandlersTests(unittest.TestCase):
                 },
             ]
         }
-        self.assertEqual(password_rules, exp_password_rules)
+        assert password_rules == exp_password_rules
 
     def test_list_error_console_not_found(self):
 
         # Remove the faked Console object
         self.hmc.consoles.remove(None)
 
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.get(self.hmc, '/api/console/password-rules', True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
     def test_get(self):
 
@@ -2454,7 +2455,7 @@ class PasswordRuleHandlersTests(unittest.TestCase):
             'description': 'Password Rule #1',
             'type': 'system-defined',
         }
-        self.assertEqual(password_rule1, exp_password_rule1)
+        assert password_rule1 == exp_password_rule1
 
     def test_create_verify(self):
         new_password_rule_input = {
@@ -2467,8 +2468,8 @@ class PasswordRuleHandlersTests(unittest.TestCase):
             self.hmc, '/api/console/password-rules', new_password_rule_input,
             True, True)
 
-        self.assertEqual(len(resp), 1)
-        self.assertIn('element-uri', resp)
+        assert len(resp) == 1
+        assert 'element-uri' in resp
         new_password_rule_uri = resp['element-uri']
 
         # the function to be tested:
@@ -2477,7 +2478,7 @@ class PasswordRuleHandlersTests(unittest.TestCase):
 
         new_name = new_password_rule['name']
         input_name = new_password_rule_input['name']
-        self.assertEqual(new_name, input_name)
+        assert new_name == input_name
 
     def test_create_error_console_not_found(self):
 
@@ -2489,14 +2490,14 @@ class PasswordRuleHandlersTests(unittest.TestCase):
             'description': 'Password Rule #X',
         }
 
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.post(self.hmc, '/api/console/password-rules',
                                  new_password_rule_input, True, True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
     def test_update_verify(self):
         update_password_rule1 = {
@@ -2511,8 +2512,7 @@ class PasswordRuleHandlersTests(unittest.TestCase):
         password_rule1 = self.urihandler.get(
             self.hmc, '/api/console/password-rules/fake-password-rule-oid-1',
             True)
-        self.assertEqual(password_rule1['description'],
-                         'updated password rule #1')
+        assert password_rule1['description'] == 'updated password rule #1'
 
     def test_delete_verify(self):
 
@@ -2535,15 +2535,15 @@ class PasswordRuleHandlersTests(unittest.TestCase):
         self.urihandler.delete(self.hmc, new_password_rule_uri, True)
 
         # Verify that it has been deleted
-        with self.assertRaises(InvalidResourceError):
+        with pytest.raises(InvalidResourceError):
             self.urihandler.get(self.hmc, new_password_rule_uri, True)
 
 
-class LdapServerDefinitionHandlersTests(unittest.TestCase):
+class TestLdapServerDefinitionHandlers(object):
     """All tests for classes LdapServerDefinitionsHandler and
     LdapServerDefinitionHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
 
         self.uris = (
@@ -2570,21 +2570,21 @@ class LdapServerDefinitionHandlersTests(unittest.TestCase):
                 },
             ]
         }
-        self.assertEqual(ldap_srv_defs, exp_ldap_srv_defs)
+        assert ldap_srv_defs == exp_ldap_srv_defs
 
     def test_list_error_console_not_found(self):
 
         # Remove the faked Console object
         self.hmc.consoles.remove(None)
 
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.get(
                 self.hmc, '/api/console/ldap-server-definitions', True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
     def test_get(self):
 
@@ -2603,7 +2603,7 @@ class LdapServerDefinitionHandlersTests(unittest.TestCase):
             'description': 'LDAP Srv Def #1',
             'primary-hostname-ipaddr': '10.11.12.13',
         }
-        self.assertEqual(ldap_srv_def1, exp_ldap_srv_def1)
+        assert ldap_srv_def1 == exp_ldap_srv_def1
 
     def test_create_verify(self):
         new_ldap_srv_def_input = {
@@ -2616,8 +2616,8 @@ class LdapServerDefinitionHandlersTests(unittest.TestCase):
             self.hmc, '/api/console/ldap-server-definitions',
             new_ldap_srv_def_input, True, True)
 
-        self.assertEqual(len(resp), 1)
-        self.assertIn('element-uri', resp)
+        assert len(resp) == 1
+        assert 'element-uri' in resp
         new_ldap_srv_def_uri = resp['element-uri']
 
         # the function to be tested:
@@ -2626,7 +2626,7 @@ class LdapServerDefinitionHandlersTests(unittest.TestCase):
 
         new_name = new_ldap_srv_def['name']
         input_name = new_ldap_srv_def_input['name']
-        self.assertEqual(new_name, input_name)
+        assert new_name == input_name
 
     def test_create_error_console_not_found(self):
 
@@ -2638,15 +2638,15 @@ class LdapServerDefinitionHandlersTests(unittest.TestCase):
             'description': 'LDAP Srv Def #X',
         }
 
-        with self.assertRaises(InvalidResourceError) as cm:
+        with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
             self.urihandler.post(
                 self.hmc, '/api/console/ldap-server-definitions',
                 new_ldap_srv_def_input, True, True)
 
-        exc = cm.exception
-        self.assertEqual(exc.reason, 1)
+        exc = exc_info.value
+        assert exc.reason == 1
 
     def test_update_verify(self):
         update_ldap_srv_def1 = {
@@ -2663,8 +2663,7 @@ class LdapServerDefinitionHandlersTests(unittest.TestCase):
             self.hmc,
             '/api/console/ldap-server-definitions/fake-ldap-srv-def-oid-1',
             True)
-        self.assertEqual(ldap_srv_def1['description'],
-                         'updated LDAP Srv Def #1')
+        assert ldap_srv_def1['description'] == 'updated LDAP Srv Def #1'
 
     def test_delete_verify(self):
 
@@ -2687,14 +2686,14 @@ class LdapServerDefinitionHandlersTests(unittest.TestCase):
         self.urihandler.delete(self.hmc, new_ldap_srv_def_uri, True)
 
         # Verify that it has been deleted
-        with self.assertRaises(InvalidResourceError):
+        with pytest.raises(InvalidResourceError):
             self.urihandler.get(self.hmc, new_ldap_srv_def_uri, True)
 
 
-class CpcHandlersTests(unittest.TestCase):
+class TestCpcHandlers(object):
     """All tests for classes CpcsHandler and CpcHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/cpcs(?:\?(.*))?', CpcsHandler),
@@ -2721,7 +2720,7 @@ class CpcHandlersTests(unittest.TestCase):
                 },
             ]
         }
-        self.assertEqual(cpcs, exp_cpcs)
+        assert cpcs == exp_cpcs
 
     def test_get(self):
 
@@ -2737,7 +2736,7 @@ class CpcHandlersTests(unittest.TestCase):
             'description': 'CPC #1 (classic mode)',
             'status': 'operating',
         }
-        self.assertEqual(cpc1, exp_cpc1)
+        assert cpc1 == exp_cpc1
 
     def test_update_verify(self):
         update_cpc1 = {
@@ -2749,13 +2748,13 @@ class CpcHandlersTests(unittest.TestCase):
                              update_cpc1, True, True)
 
         cpc1 = self.urihandler.get(self.hmc, '/api/cpcs/1', True)
-        self.assertEqual(cpc1['description'], 'updated cpc #1')
+        assert cpc1['description'] == 'updated cpc #1'
 
 
-class CpcStartStopHandlerTests(unittest.TestCase):
+class TestCpcStartStopHandler(object):
     """All tests for classes CpcStartHandler and CpcStopHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/cpcs/([^/]+)', CpcHandler),
@@ -2767,53 +2766,53 @@ class CpcStartStopHandlerTests(unittest.TestCase):
     def test_stop_classic(self):
         # CPC1 is in classic mode
         cpc1 = self.urihandler.get(self.hmc, '/api/cpcs/1', True)
-        self.assertEqual(cpc1['status'], 'operating')
+        assert cpc1['status'] == 'operating'
 
         # the function to be tested:
-        with self.assertRaises(CpcNotInDpmError):
+        with pytest.raises(CpcNotInDpmError):
             self.urihandler.post(self.hmc, '/api/cpcs/1/operations/stop',
                                  None, True, True)
 
         cpc1 = self.urihandler.get(self.hmc, '/api/cpcs/1', True)
-        self.assertEqual(cpc1['status'], 'operating')
+        assert cpc1['status'] == 'operating'
 
     def test_start_classic(self):
         # CPC1 is in classic mode
         cpc1 = self.urihandler.get(self.hmc, '/api/cpcs/1', True)
-        self.assertEqual(cpc1['status'], 'operating')
+        assert cpc1['status'] == 'operating'
 
         # the function to be tested:
-        with self.assertRaises(CpcNotInDpmError):
+        with pytest.raises(CpcNotInDpmError):
             self.urihandler.post(self.hmc, '/api/cpcs/1/operations/start',
                                  None, True, True)
 
         cpc1 = self.urihandler.get(self.hmc, '/api/cpcs/1', True)
-        self.assertEqual(cpc1['status'], 'operating')
+        assert cpc1['status'] == 'operating'
 
     def test_stop_start_dpm(self):
         # CPC2 is in DPM mode
         cpc2 = self.urihandler.get(self.hmc, '/api/cpcs/2', True)
-        self.assertEqual(cpc2['status'], 'active')
+        assert cpc2['status'] == 'active'
 
         # the function to be tested:
         self.urihandler.post(self.hmc, '/api/cpcs/2/operations/stop',
                              None, True, True)
 
         cpc2 = self.urihandler.get(self.hmc, '/api/cpcs/2', True)
-        self.assertEqual(cpc2['status'], 'not-operating')
+        assert cpc2['status'] == 'not-operating'
 
         # the function to be tested:
         self.urihandler.post(self.hmc, '/api/cpcs/2/operations/start',
                              None, True, True)
 
         cpc2 = self.urihandler.get(self.hmc, '/api/cpcs/2', True)
-        self.assertEqual(cpc2['status'], 'active')
+        assert cpc2['status'] == 'active'
 
 
-class CpcExportPortNamesListHandlerTests(unittest.TestCase):
+class TestCpcExportPortNamesListHandler(object):
     """All tests for class CpcExportPortNamesListHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/cpcs(?:\?(.*))?', CpcsHandler),
@@ -2826,7 +2825,7 @@ class CpcExportPortNamesListHandlerTests(unittest.TestCase):
     def test_invoke_err_no_input(self):
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc, '/api/cpcs/2/operations/export-port-names-list',
                 None, True, True)
@@ -2846,16 +2845,16 @@ class CpcExportPortNamesListHandlerTests(unittest.TestCase):
             self.hmc, '/api/cpcs/2/operations/export-port-names-list',
             operation_body, True, True)
 
-        self.assertEqual(len(resp), 1)
-        self.assertIn('wwpn-list', resp)
+        assert len(resp) == 1
+        assert 'wwpn-list' in resp
         wwpn_list = resp['wwpn-list']
-        self.assertEqual(wwpn_list, exp_wwpn_list)
+        assert wwpn_list == exp_wwpn_list
 
 
-class CpcImportProfilesHandlerTests(unittest.TestCase):
+class TestCpcImportProfilesHandler(object):
     """All tests for class CpcImportProfilesHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/cpcs(?:\?(.*))?', CpcsHandler),
@@ -2868,7 +2867,7 @@ class CpcImportProfilesHandlerTests(unittest.TestCase):
     def test_invoke_err_no_input(self):
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc, '/api/cpcs/1/operations/import-profiles',
                 None, True, True)
@@ -2883,13 +2882,13 @@ class CpcImportProfilesHandlerTests(unittest.TestCase):
             self.hmc, '/api/cpcs/1/operations/import-profiles',
             operation_body, True, True)
 
-        self.assertIsNone(resp)
+        assert resp is None
 
 
-class CpcExportProfilesHandlerTests(unittest.TestCase):
+class TestCpcExportProfilesHandler(object):
     """All tests for class CpcExportProfilesHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/cpcs(?:\?(.*))?', CpcsHandler),
@@ -2902,7 +2901,7 @@ class CpcExportProfilesHandlerTests(unittest.TestCase):
     def test_invoke_err_no_input(self):
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc, '/api/cpcs/1/operations/export-profiles',
                 None, True, True)
@@ -2917,14 +2916,14 @@ class CpcExportProfilesHandlerTests(unittest.TestCase):
             self.hmc, '/api/cpcs/1/operations/export-profiles',
             operation_body, True, True)
 
-        self.assertIsNone(resp)
+        assert resp is None
 
 
-class MetricsContextHandlersTests(unittest.TestCase):
+class TestMetricsContextHandlers(object):
     """All tests for classes MetricsContextsHandler and
     MetricsContextHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/services/metrics/context', MetricsContextsHandler),
@@ -3023,13 +3022,13 @@ class MetricsContextHandlersTests(unittest.TestCase):
         resp = self.urihandler.post(self.hmc, '/api/services/metrics/context',
                                     body, True, True)
 
-        self.assertIsInstance(resp, dict)
-        self.assertIn('metrics-context-uri', resp)
+        assert isinstance(resp, dict)
+        assert 'metrics-context-uri' in resp
         uri = resp['metrics-context-uri']
-        self.assertTrue(uri.startswith('/api/services/metrics/context/'))
-        self.assertIn('metric-group-infos', resp)
+        assert uri.startswith('/api/services/metrics/context/')
+        assert 'metric-group-infos' in resp
         mg_infos = resp['metric-group-infos']
-        self.assertEqual(mg_infos, [mg_info, mg_info2])
+        assert mg_infos == [mg_info, mg_info2]
 
         # the get function to be tested:
         mv_resp = self.urihandler.get(self.hmc, uri, True)
@@ -3052,20 +3051,19 @@ class MetricsContextHandlersTests(unittest.TestCase):
 
 
 '''
-        self.assertEqual(
-            mv_resp, exp_mv_resp,
-            "Actual response string:\n{!r}\n"
-            "Expected response string:\n{!r}\n".
-            format(mv_resp, exp_mv_resp))
+        assert mv_resp == exp_mv_resp, \
+            "Actual response string:\n{!r}\n" \
+            "Expected response string:\n{!r}\n". \
+            format(mv_resp, exp_mv_resp)
 
         # the delete function to be tested:
         self.urihandler.delete(self.hmc, uri, True)
 
 
-class AdapterHandlersTests(unittest.TestCase):
+class TestAdapterHandlers(object):
     """All tests for classes AdaptersHandler and AdapterHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/cpcs/([^/]+)/adapters(?:\?(.*))?', AdaptersHandler),
@@ -3107,7 +3105,7 @@ class AdapterHandlersTests(unittest.TestCase):
                 },
             ]
         }
-        self.assertEqual(adapters, exp_adapters)
+        assert adapters == exp_adapters
 
     def test_get(self):
 
@@ -3124,7 +3122,7 @@ class AdapterHandlersTests(unittest.TestCase):
             'network-port-uris': ['/api/adapters/1/network-ports/1'],
             'adapter-id': 'BEF',
         }
-        self.assertEqual(adapter1, exp_adapter1)
+        assert adapter1 == exp_adapter1
 
     def test_update_verify(self):
         update_adapter1 = {
@@ -3136,13 +3134,13 @@ class AdapterHandlersTests(unittest.TestCase):
                              update_adapter1, True, True)
 
         adapter1 = self.urihandler.get(self.hmc, '/api/adapters/1', True)
-        self.assertEqual(adapter1['description'], 'updated adapter #1')
+        assert adapter1['description'] == 'updated adapter #1'
 
 
-class AdapterChangeCryptoTypeHandlerTests(unittest.TestCase):
+class TestAdapterChangeCryptoTypeHandler(object):
     """All tests for class AdapterChangeCryptoTypeHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/cpcs/([^/]+)/adapters(?:\?(.*))?', AdaptersHandler),
@@ -3155,7 +3153,7 @@ class AdapterChangeCryptoTypeHandlerTests(unittest.TestCase):
     def test_invoke_err_no_body(self):
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc,
                 '/api/adapters/4/operations/change-crypto-type',
@@ -3168,7 +3166,7 @@ class AdapterChangeCryptoTypeHandlerTests(unittest.TestCase):
         }
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc,
                 '/api/adapters/4/operations/change-crypto-type',
@@ -3185,13 +3183,13 @@ class AdapterChangeCryptoTypeHandlerTests(unittest.TestCase):
             '/api/adapters/4/operations/change-crypto-type',
             operation_body, True, True)
 
-        self.assertIsNone(resp)
+        assert resp is None
 
 
-class NetworkPortHandlersTests(unittest.TestCase):
+class TestNetworkPortHandlers(object):
     """All tests for class NetworkPortHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/adapters/([^/]+)/network-ports/([^/]+)',
@@ -3211,7 +3209,7 @@ class NetworkPortHandlersTests(unittest.TestCase):
             'name': 'osa_1_port_1',
             'description': 'Port #1 of OSA #1',
         }
-        self.assertEqual(port1, exp_port1)
+        assert port1 == exp_port1
 
     def test_update_verify(self):
         update_port1 = {
@@ -3224,13 +3222,13 @@ class NetworkPortHandlersTests(unittest.TestCase):
 
         port1 = self.urihandler.get(self.hmc,
                                     '/api/adapters/1/network-ports/1', True)
-        self.assertEqual(port1['description'], 'updated port #1')
+        assert port1['description'] == 'updated port #1'
 
 
-class StoragePortHandlersTests(unittest.TestCase):
+class TestStoragePortHandlers(object):
     """All tests for class StoragePortHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/adapters/([^/]+)/storage-ports/([^/]+)',
@@ -3250,7 +3248,7 @@ class StoragePortHandlersTests(unittest.TestCase):
             'name': 'fcp_2_port_1',
             'description': 'Port #1 of FCP #2',
         }
-        self.assertEqual(port1, exp_port1)
+        assert port1 == exp_port1
 
     def test_update_verify(self):
         update_port1 = {
@@ -3263,13 +3261,13 @@ class StoragePortHandlersTests(unittest.TestCase):
 
         port1 = self.urihandler.get(self.hmc,
                                     '/api/adapters/2/storage-ports/1', True)
-        self.assertEqual(port1['description'], 'updated port #1')
+        assert port1['description'] == 'updated port #1'
 
 
-class PartitionHandlersTests(unittest.TestCase):
+class TestPartitionHandlers(object):
     """All tests for classes PartitionsHandler and PartitionHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/cpcs/([^/]+)/partitions(?:\?(.*))?', PartitionsHandler),
@@ -3292,7 +3290,7 @@ class PartitionHandlersTests(unittest.TestCase):
                 },
             ]
         }
-        self.assertEqual(partitions, exp_partitions)
+        assert partitions == exp_partitions
 
     def test_get(self):
 
@@ -3309,7 +3307,7 @@ class PartitionHandlersTests(unittest.TestCase):
             'nic-uris': ['/api/partitions/1/nics/1'],
             'virtual-function-uris': ['/api/partitions/1/virtual-functions/1'],
         }
-        self.assertEqual(partition1, exp_partition1)
+        assert partition1 == exp_partition1
 
     def test_create_verify(self):
         new_partition2 = {
@@ -3323,10 +3321,10 @@ class PartitionHandlersTests(unittest.TestCase):
         resp = self.urihandler.post(self.hmc, '/api/cpcs/2/partitions',
                                     new_partition2, True, True)
 
-        self.assertEqual(len(resp), 1)
-        self.assertIn('object-uri', resp)
+        assert len(resp) == 1
+        assert 'object-uri' in resp
         new_partition2_uri = resp['object-uri']
-        self.assertEqual(new_partition2_uri, '/api/partitions/2')
+        assert new_partition2_uri == '/api/partitions/2'
 
         exp_partition2 = {
             'object-id': '2',
@@ -3343,7 +3341,7 @@ class PartitionHandlersTests(unittest.TestCase):
         # the function to be tested:
         partition2 = self.urihandler.get(self.hmc, '/api/partitions/2', True)
 
-        self.assertEqual(partition2, exp_partition2)
+        assert partition2 == exp_partition2
 
     def test_update_verify(self):
         update_partition1 = {
@@ -3355,7 +3353,7 @@ class PartitionHandlersTests(unittest.TestCase):
                              update_partition1, True, True)
 
         partition1 = self.urihandler.get(self.hmc, '/api/partitions/1', True)
-        self.assertEqual(partition1['description'], 'updated partition #1')
+        assert partition1['description'] == 'updated partition #1'
 
     def test_delete_verify(self):
 
@@ -3364,14 +3362,14 @@ class PartitionHandlersTests(unittest.TestCase):
         # the function to be tested:
         self.urihandler.delete(self.hmc, '/api/partitions/1', True)
 
-        with self.assertRaises(InvalidResourceError):
+        with pytest.raises(InvalidResourceError):
             self.urihandler.get(self.hmc, '/api/partitions/1', True)
 
 
-class PartitionStartStopHandlerTests(unittest.TestCase):
+class TestPartitionStartStopHandler(object):
     """All tests for classes PartitionStartHandler and PartitionStopHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/partitions/([^/]+)', PartitionHandler),
@@ -3384,38 +3382,38 @@ class PartitionStartStopHandlerTests(unittest.TestCase):
     def test_start_stop(self):
         # CPC2 is in DPM mode
         partition1 = self.urihandler.get(self.hmc, '/api/partitions/1', True)
-        self.assertEqual(partition1['status'], 'stopped')
+        assert partition1['status'] == 'stopped'
 
         # the start() function to be tested, with a valid initial status:
         self.urihandler.post(self.hmc, '/api/partitions/1/operations/start',
                              None, True, True)
         partition1 = self.urihandler.get(self.hmc, '/api/partitions/1', True)
-        self.assertEqual(partition1['status'], 'active')
+        assert partition1['status'] == 'active'
 
         # the start() function to be tested, with an invalid initial status:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(self.hmc,
                                  '/api/partitions/1/operations/start',
                                  None, True, True)
 
         # the stop() function to be tested, with a valid initial status:
-        self.assertEqual(partition1['status'], 'active')
+        assert partition1['status'] == 'active'
         self.urihandler.post(self.hmc, '/api/partitions/1/operations/stop',
                              None, True, True)
         partition1 = self.urihandler.get(self.hmc, '/api/partitions/1', True)
-        self.assertEqual(partition1['status'], 'stopped')
+        assert partition1['status'] == 'stopped'
 
         # the stop() function to be tested, with an invalid initial status:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(self.hmc,
                                  '/api/partitions/1/operations/stop',
                                  None, True, True)
 
 
-class PartitionScsiDumpHandlerTests(unittest.TestCase):
+class TestPartitionScsiDumpHandler(object):
     """All tests for class PartitionScsiDumpHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/partitions/([^/]+)', PartitionHandler),
@@ -3427,7 +3425,7 @@ class PartitionScsiDumpHandlerTests(unittest.TestCase):
     def test_invoke_err_no_body(self):
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc, '/api/partitions/1/operations/scsi-dump',
                 None, True, True)
@@ -3440,7 +3438,7 @@ class PartitionScsiDumpHandlerTests(unittest.TestCase):
         }
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc, '/api/partitions/1/operations/scsi-dump',
                 operation_body, True, True)
@@ -3453,7 +3451,7 @@ class PartitionScsiDumpHandlerTests(unittest.TestCase):
         }
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc, '/api/partitions/1/operations/scsi-dump',
                 operation_body, True, True)
@@ -3466,7 +3464,7 @@ class PartitionScsiDumpHandlerTests(unittest.TestCase):
         }
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc, '/api/partitions/1/operations/scsi-dump',
                 operation_body, True, True)
@@ -3483,7 +3481,7 @@ class PartitionScsiDumpHandlerTests(unittest.TestCase):
         partition1['status'] = 'stopped'
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc, '/api/partitions/1/operations/scsi-dump',
                 operation_body, True, True)
@@ -3504,13 +3502,13 @@ class PartitionScsiDumpHandlerTests(unittest.TestCase):
             self.hmc, '/api/partitions/1/operations/scsi-dump',
             operation_body, True, True)
 
-        self.assertEqual(resp, {})
+        assert resp == {}
 
 
-class PartitionPswRestartHandlerTests(unittest.TestCase):
+class TestPartitionPswRestartHandler(object):
     """All tests for class PartitionPswRestartHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/partitions/([^/]+)', PartitionHandler),
@@ -3526,7 +3524,7 @@ class PartitionPswRestartHandlerTests(unittest.TestCase):
         partition1['status'] = 'stopped'
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc, '/api/partitions/1/operations/psw-restart',
                 None, True, True)
@@ -3542,13 +3540,13 @@ class PartitionPswRestartHandlerTests(unittest.TestCase):
             self.hmc, '/api/partitions/1/operations/psw-restart',
             None, True, True)
 
-        self.assertEqual(resp, {})
+        assert resp == {}
 
 
-class PartitionMountIsoImageHandlerTests(unittest.TestCase):
+class TestPartitionMountIsoImageHandler(object):
     """All tests for class PartitionMountIsoImageHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/partitions/([^/]+)', PartitionHandler),
@@ -3560,7 +3558,7 @@ class PartitionMountIsoImageHandlerTests(unittest.TestCase):
     def test_invoke_err_queryparm_1(self):
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc, '/api/partitions/1/operations/mount-iso-image?'
                 'image-namex=fake-image&ins-file-name=fake-ins',
@@ -3569,7 +3567,7 @@ class PartitionMountIsoImageHandlerTests(unittest.TestCase):
     def test_invoke_err_queryparm_2(self):
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc, '/api/partitions/1/operations/mount-iso-image?'
                 'image-name=fake-image&ins-file-namex=fake-ins',
@@ -3582,7 +3580,7 @@ class PartitionMountIsoImageHandlerTests(unittest.TestCase):
         partition1['status'] = 'starting'
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc, '/api/partitions/1/operations/mount-iso-image?'
                 'image-name=fake-image&ins-file-name=fake-ins',
@@ -3600,19 +3598,19 @@ class PartitionMountIsoImageHandlerTests(unittest.TestCase):
             'image-name=fake-image&ins-file-name=fake-ins',
             None, True, True)
 
-        self.assertEqual(resp, {})
+        assert resp == {}
 
         boot_iso_image_name = partition1['boot-iso-image-name']
-        self.assertEqual(boot_iso_image_name, 'fake-image')
+        assert boot_iso_image_name == 'fake-image'
 
         boot_iso_ins_file = partition1['boot-iso-ins-file']
-        self.assertEqual(boot_iso_ins_file, 'fake-ins')
+        assert boot_iso_ins_file == 'fake-ins'
 
 
-class PartitionUnmountIsoImageHandlerTests(unittest.TestCase):
+class TestPartitionUnmountIsoImageHandler(object):
     """All tests for class PartitionUnmountIsoImageHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/partitions/([^/]+)', PartitionHandler),
@@ -3628,7 +3626,7 @@ class PartitionUnmountIsoImageHandlerTests(unittest.TestCase):
         partition1['status'] = 'starting'
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc, '/api/partitions/1/operations/unmount-iso-image',
                 None, True, True)
@@ -3644,19 +3642,19 @@ class PartitionUnmountIsoImageHandlerTests(unittest.TestCase):
             self.hmc, '/api/partitions/1/operations/unmount-iso-image',
             None, True, True)
 
-        self.assertEqual(resp, {})
+        assert resp == {}
 
         boot_iso_image_name = partition1['boot-iso-image-name']
-        self.assertIsNone(boot_iso_image_name)
+        assert boot_iso_image_name is None
 
         boot_iso_ins_file = partition1['boot-iso-ins-file']
-        self.assertIsNone(boot_iso_ins_file)
+        assert boot_iso_ins_file is None
 
 
-class PartitionIncreaseCryptoConfigHandlerTests(unittest.TestCase):
+class TestPartitionIncreaseCryptoConfigHandler(object):
     """All tests for class PartitionIncreaseCryptoConfigHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/partitions/([^/]+)', PartitionHandler),
@@ -3669,7 +3667,7 @@ class PartitionIncreaseCryptoConfigHandlerTests(unittest.TestCase):
     def test_invoke_err_missing_body(self):
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc,
                 '/api/partitions/1/operations/increase-crypto-configuration',
@@ -3682,7 +3680,7 @@ class PartitionIncreaseCryptoConfigHandlerTests(unittest.TestCase):
         partition1['status'] = 'starting'
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc,
                 '/api/partitions/1/operations/increase-crypto-configuration',
@@ -3738,28 +3736,28 @@ class PartitionIncreaseCryptoConfigHandlerTests(unittest.TestCase):
                 '/api/partitions/1/operations/increase-crypto-configuration',
                 operation_body, True, True)
 
-            self.assertIsNone(resp)
+            assert resp is None
 
             crypto_config = partition1['crypto-configuration']
-            self.assertTrue(isinstance(crypto_config, dict))
+            assert isinstance(crypto_config, dict)
 
             adapter_uris = crypto_config['crypto-adapter-uris']
-            self.assertTrue(isinstance(adapter_uris, list))
+            assert isinstance(adapter_uris, list)
             exp_adapter_uris = input_adapter_uris \
                 if input_adapter_uris is not None else []
-            self.assertEqual(adapter_uris, exp_adapter_uris)
+            assert adapter_uris == exp_adapter_uris
 
             domain_configs = crypto_config['crypto-domain-configurations']
-            self.assertTrue(isinstance(domain_configs, list))
+            assert isinstance(domain_configs, list)
             exp_domain_configs = input_domain_configs \
                 if input_domain_configs is not None else []
-            self.assertEqual(domain_configs, exp_domain_configs)
+            assert domain_configs == exp_domain_configs
 
 
-class PartitionDecreaseCryptoConfigHandlerTests(unittest.TestCase):
+class TestPartitionDecreaseCryptoConfigHandler(object):
     """All tests for class PartitionDecreaseCryptoConfigHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/partitions/([^/]+)', PartitionHandler),
@@ -3772,7 +3770,7 @@ class PartitionDecreaseCryptoConfigHandlerTests(unittest.TestCase):
     def test_invoke_err_missing_body(self):
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc,
                 '/api/partitions/1/operations/decrease-crypto-configuration',
@@ -3785,7 +3783,7 @@ class PartitionDecreaseCryptoConfigHandlerTests(unittest.TestCase):
         partition1['status'] = 'starting'
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc,
                 '/api/partitions/1/operations/decrease-crypto-configuration',
@@ -3847,22 +3845,22 @@ class PartitionDecreaseCryptoConfigHandlerTests(unittest.TestCase):
                 '/api/partitions/1/operations/decrease-crypto-configuration',
                 operation_body, True, True)
 
-            self.assertIsNone(resp)
+            assert resp is None
 
             crypto_config = partition1['crypto-configuration']
-            self.assertTrue(isinstance(crypto_config, dict))
+            assert isinstance(crypto_config, dict)
 
             adapter_uris = crypto_config['crypto-adapter-uris']
-            self.assertTrue(isinstance(adapter_uris, list))
+            assert isinstance(adapter_uris, list)
 
             domain_configs = crypto_config['crypto-domain-configurations']
-            self.assertTrue(isinstance(domain_configs, list))
+            assert isinstance(domain_configs, list)
 
 
-class PartitionChangeCryptoConfigHandlerTests(unittest.TestCase):
+class TestPartitionChangeCryptoConfigHandler(object):
     """All tests for class PartitionChangeCryptoConfigHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/partitions/([^/]+)', PartitionHandler),
@@ -3875,7 +3873,7 @@ class PartitionChangeCryptoConfigHandlerTests(unittest.TestCase):
     def test_invoke_err_missing_body(self):
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc,
                 '/api/partitions/1/operations/'
@@ -3890,7 +3888,7 @@ class PartitionChangeCryptoConfigHandlerTests(unittest.TestCase):
         }
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc,
                 '/api/partitions/1/operations/'
@@ -3905,7 +3903,7 @@ class PartitionChangeCryptoConfigHandlerTests(unittest.TestCase):
         }
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc,
                 '/api/partitions/1/operations/'
@@ -3919,7 +3917,7 @@ class PartitionChangeCryptoConfigHandlerTests(unittest.TestCase):
         partition1['status'] = 'starting'
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc,
                 '/api/partitions/1/operations/'
@@ -3969,22 +3967,22 @@ class PartitionChangeCryptoConfigHandlerTests(unittest.TestCase):
                 'change-crypto-domain-configuration',
                 operation_body, True, True)
 
-            self.assertIsNone(resp)
+            assert resp is None
 
             crypto_config = partition1['crypto-configuration']
-            self.assertTrue(isinstance(crypto_config, dict))
+            assert isinstance(crypto_config, dict)
 
             adapter_uris = crypto_config['crypto-adapter-uris']
-            self.assertTrue(isinstance(adapter_uris, list))
+            assert isinstance(adapter_uris, list)
 
             domain_configs = crypto_config['crypto-domain-configurations']
-            self.assertTrue(isinstance(domain_configs, list))
+            assert isinstance(domain_configs, list)
 
 
-class HbaHandlerTests(unittest.TestCase):
+class TestHbaHandler(object):
     """All tests for classes HbasHandler and HbaHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/partitions/([^/]+)', PartitionHandler),
@@ -4003,7 +4001,7 @@ class HbaHandlerTests(unittest.TestCase):
         exp_hba_uris = [
             '/api/partitions/1/hbas/1',
         ]
-        self.assertEqual(hba_uris, exp_hba_uris)
+        assert hba_uris == exp_hba_uris
 
     def test_get(self):
 
@@ -4022,7 +4020,7 @@ class HbaHandlerTests(unittest.TestCase):
             'wwpn': 'CFFEAFFE00008001',
             'device-number': '1001',
         }
-        self.assertEqual(hba1, exp_hba1)
+        assert hba1 == exp_hba1
 
     def test_create_verify(self):
         new_hba2 = {
@@ -4035,10 +4033,10 @@ class HbaHandlerTests(unittest.TestCase):
         resp = self.urihandler.post(self.hmc, '/api/partitions/1/hbas',
                                     new_hba2, True, True)
 
-        self.assertEqual(len(resp), 1)
-        self.assertIn('element-uri', resp)
+        assert len(resp) == 1
+        assert 'element-uri' in resp
         new_hba2_uri = resp['element-uri']
-        self.assertEqual(new_hba2_uri, '/api/partitions/1/hbas/2')
+        assert new_hba2_uri == '/api/partitions/1/hbas/2'
 
         # the function to be tested:
         hba2 = self.urihandler.get(self.hmc, '/api/partitions/1/hbas/2', True)
@@ -4052,7 +4050,7 @@ class HbaHandlerTests(unittest.TestCase):
             'wwpn': hba2['wwpn'],  # auto-generated
         }
 
-        self.assertEqual(hba2, exp_hba2)
+        assert hba2 == exp_hba2
 
     def test_update_verify(self):
         update_hba1 = {
@@ -4064,7 +4062,7 @@ class HbaHandlerTests(unittest.TestCase):
                              update_hba1, True, True)
 
         hba1 = self.urihandler.get(self.hmc, '/api/partitions/1/hbas/1', True)
-        self.assertEqual(hba1['description'], 'updated hba #1')
+        assert hba1['description'] == 'updated hba #1'
 
     def test_delete_verify(self):
 
@@ -4073,14 +4071,14 @@ class HbaHandlerTests(unittest.TestCase):
         # the function to be tested:
         self.urihandler.delete(self.hmc, '/api/partitions/1/hbas/1', True)
 
-        with self.assertRaises(InvalidResourceError):
+        with pytest.raises(InvalidResourceError):
             self.urihandler.get(self.hmc, '/api/partitions/1/hbas/1', True)
 
 
-class HbaReassignPortHandlerTests(unittest.TestCase):
+class TestHbaReassignPortHandler(object):
     """All tests for class HbaReassignPortHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/partitions/([^/]+)', PartitionHandler),
@@ -4094,7 +4092,7 @@ class HbaReassignPortHandlerTests(unittest.TestCase):
     def test_invoke_err_missing_body(self):
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc,
                 '/api/partitions/1/hbas/1/operations/'
@@ -4107,7 +4105,7 @@ class HbaReassignPortHandlerTests(unittest.TestCase):
         }
 
         # the function to be tested:
-        with self.assertRaises(HTTPError):
+        with pytest.raises(HTTPError):
             self.urihandler.post(
                 self.hmc,
                 '/api/partitions/1/hbas/1/operations/'
@@ -4127,17 +4125,17 @@ class HbaReassignPortHandlerTests(unittest.TestCase):
             'reassign-storage-adapter-port',
             operation_body, True, True)
 
-        self.assertIsNone(resp)
+        assert resp is None
 
         hba = self.urihandler.get(self.hmc, '/api/partitions/1/hbas/1', True)
         adapter_port_uri = hba['adapter-port-uri']
-        self.assertEqual(adapter_port_uri, new_adapter_port_uri)
+        assert adapter_port_uri == new_adapter_port_uri
 
 
-class NicHandlerTests(unittest.TestCase):
+class TestNicHandler(object):
     """All tests for classes NicsHandler and NicHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/partitions/([^/]+)', PartitionHandler),
@@ -4156,7 +4154,7 @@ class NicHandlerTests(unittest.TestCase):
         exp_nic_uris = [
             '/api/partitions/1/nics/1',
         ]
-        self.assertEqual(nic_uris, exp_nic_uris)
+        assert nic_uris == exp_nic_uris
 
     def test_get(self):
 
@@ -4174,7 +4172,7 @@ class NicHandlerTests(unittest.TestCase):
             'network-adapter-port-uri': '/api/adapters/3/network-ports/1',
             'device-number': '2001',
         }
-        self.assertEqual(nic1, exp_nic1)
+        assert nic1 == exp_nic1
 
     def test_create_verify(self):
         new_nic2 = {
@@ -4187,10 +4185,10 @@ class NicHandlerTests(unittest.TestCase):
         resp = self.urihandler.post(self.hmc, '/api/partitions/1/nics',
                                     new_nic2, True, True)
 
-        self.assertEqual(len(resp), 1)
-        self.assertIn('element-uri', resp)
+        assert len(resp) == 1
+        assert 'element-uri' in resp
         new_nic2_uri = resp['element-uri']
-        self.assertEqual(new_nic2_uri, '/api/partitions/1/nics/2')
+        assert new_nic2_uri == '/api/partitions/1/nics/2'
 
         # the function to be tested:
         nic2 = self.urihandler.get(self.hmc, '/api/partitions/1/nics/2', True)
@@ -4203,7 +4201,7 @@ class NicHandlerTests(unittest.TestCase):
             'device-number': nic2['device-number'],  # auto-generated
         }
 
-        self.assertEqual(nic2, exp_nic2)
+        assert nic2 == exp_nic2
 
     def test_update_verify(self):
         update_nic1 = {
@@ -4215,7 +4213,7 @@ class NicHandlerTests(unittest.TestCase):
                              update_nic1, True, True)
 
         nic1 = self.urihandler.get(self.hmc, '/api/partitions/1/nics/1', True)
-        self.assertEqual(nic1['description'], 'updated nic #1')
+        assert nic1['description'] == 'updated nic #1'
 
     def test_delete_verify(self):
 
@@ -4224,15 +4222,15 @@ class NicHandlerTests(unittest.TestCase):
         # the function to be tested:
         self.urihandler.delete(self.hmc, '/api/partitions/1/nics/1', True)
 
-        with self.assertRaises(InvalidResourceError):
+        with pytest.raises(InvalidResourceError):
             self.urihandler.get(self.hmc, '/api/partitions/1/nics/1', True)
 
 
-class VirtualFunctionHandlerTests(unittest.TestCase):
+class TestVirtualFunctionHandler(object):
     """All tests for classes VirtualFunctionsHandler and
     VirtualFunctionHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/partitions/([^/]+)', PartitionHandler),
@@ -4253,7 +4251,7 @@ class VirtualFunctionHandlerTests(unittest.TestCase):
         exp_vf_uris = [
             '/api/partitions/1/virtual-functions/1',
         ]
-        self.assertEqual(vf_uris, exp_vf_uris)
+        assert vf_uris == exp_vf_uris
 
     def test_get(self):
 
@@ -4270,7 +4268,7 @@ class VirtualFunctionHandlerTests(unittest.TestCase):
             'description': 'VF #1 in Partition #1',
             'device-number': '3001',
         }
-        self.assertEqual(vf1, exp_vf1)
+        assert vf1 == exp_vf1
 
     def test_create_verify(self):
         new_vf2 = {
@@ -4283,10 +4281,10 @@ class VirtualFunctionHandlerTests(unittest.TestCase):
                                     '/api/partitions/1/virtual-functions',
                                     new_vf2, True, True)
 
-        self.assertEqual(len(resp), 1)
-        self.assertIn('element-uri', resp)
+        assert len(resp) == 1
+        assert 'element-uri' in resp
         new_vf2_uri = resp['element-uri']
-        self.assertEqual(new_vf2_uri, '/api/partitions/1/virtual-functions/2')
+        assert new_vf2_uri == '/api/partitions/1/virtual-functions/2'
 
         # the function to be tested:
         vf2 = self.urihandler.get(self.hmc,
@@ -4300,7 +4298,7 @@ class VirtualFunctionHandlerTests(unittest.TestCase):
             'device-number': vf2['device-number'],  # auto-generated
         }
 
-        self.assertEqual(vf2, exp_vf2)
+        assert vf2 == exp_vf2
 
     def test_update_verify(self):
         update_vf1 = {
@@ -4314,7 +4312,7 @@ class VirtualFunctionHandlerTests(unittest.TestCase):
         vf1 = self.urihandler.get(self.hmc,
                                   '/api/partitions/1/virtual-functions/1',
                                   True)
-        self.assertEqual(vf1['description'], 'updated vf #1')
+        assert vf1['description'] == 'updated vf #1'
 
     def test_delete_verify(self):
 
@@ -4325,16 +4323,16 @@ class VirtualFunctionHandlerTests(unittest.TestCase):
         self.urihandler.delete(self.hmc,
                                '/api/partitions/1/virtual-functions/1', True)
 
-        with self.assertRaises(InvalidResourceError):
+        with pytest.raises(InvalidResourceError):
             self.urihandler.get(self.hmc,
                                 '/api/partitions/1/virtual-functions/1', True)
 
 
-class VirtualSwitchHandlersTests(unittest.TestCase):
+class TestVirtualSwitchHandlers(object):
     """All tests for classes VirtualSwitchesHandler and
     VirtualSwitchHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/cpcs/([^/]+)/virtual-switches(?:\?(.*))?',
@@ -4358,7 +4356,7 @@ class VirtualSwitchHandlersTests(unittest.TestCase):
                 },
             ]
         }
-        self.assertEqual(vswitches, exp_vswitches)
+        assert vswitches == exp_vswitches
 
     def test_get(self):
 
@@ -4373,13 +4371,13 @@ class VirtualSwitchHandlersTests(unittest.TestCase):
             'description': 'Vswitch for OSA #1 in CPC #2',
             'connected-vnic-uris': [],  # auto-generated
         }
-        self.assertEqual(vswitch1, exp_vswitch1)
+        assert vswitch1 == exp_vswitch1
 
 
-class VirtualSwitchGetVnicsHandlerTests(unittest.TestCase):
+class TestVirtualSwitchGetVnicsHandler(object):
     """All tests for class VirtualSwitchGetVnicsHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/virtual-switches/([^/]+)', VirtualSwitchHandler),
@@ -4406,13 +4404,13 @@ class VirtualSwitchGetVnicsHandlerTests(unittest.TestCase):
         exp_resp = {
             'connected-vnic-uris': connected_nic_uris,
         }
-        self.assertEqual(resp, exp_resp)
+        assert resp == exp_resp
 
 
-class LparHandlersTests(unittest.TestCase):
+class TestLparHandlers(object):
     """All tests for classes LparsHandler and LparHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/cpcs/([^/]+)/logical-partitions(?:\?(.*))?', LparsHandler),
@@ -4435,7 +4433,7 @@ class LparHandlersTests(unittest.TestCase):
                 },
             ]
         }
-        self.assertEqual(lpars, exp_lpars)
+        assert lpars == exp_lpars
 
     def test_get(self):
 
@@ -4450,14 +4448,14 @@ class LparHandlersTests(unittest.TestCase):
             'status': 'not-activated',
             'description': 'LPAR #1 in CPC #1',
         }
-        self.assertEqual(lpar1, exp_lpar1)
+        assert lpar1 == exp_lpar1
 
 
-class LparActLoadDeactHandlerTests(unittest.TestCase):
+class TestLparActLoadDeactHandler(object):
     """All tests for classes LparActivateHandler, LparLoadHandler, and
     LparDeactivateHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/logical-partitions/([^/]+)',
@@ -4475,7 +4473,7 @@ class LparActLoadDeactHandlerTests(unittest.TestCase):
         # CPC1 is in classic mode
         lpar1 = self.urihandler.get(self.hmc, '/api/logical-partitions/1',
                                     True)
-        self.assertEqual(lpar1['status'], 'not-activated')
+        assert lpar1['status'] == 'not-activated'
 
         # the function to be tested:
         self.urihandler.post(self.hmc,
@@ -4484,7 +4482,7 @@ class LparActLoadDeactHandlerTests(unittest.TestCase):
 
         lpar1 = self.urihandler.get(self.hmc, '/api/logical-partitions/1',
                                     True)
-        self.assertEqual(lpar1['status'], 'not-operating')
+        assert lpar1['status'] == 'not-operating'
 
         # the function to be tested:
         self.urihandler.post(self.hmc,
@@ -4493,7 +4491,7 @@ class LparActLoadDeactHandlerTests(unittest.TestCase):
 
         lpar1 = self.urihandler.get(self.hmc, '/api/logical-partitions/1',
                                     True)
-        self.assertEqual(lpar1['status'], 'operating')
+        assert lpar1['status'] == 'operating'
 
         # the function to be tested:
         self.urihandler.post(self.hmc,
@@ -4502,14 +4500,14 @@ class LparActLoadDeactHandlerTests(unittest.TestCase):
 
         lpar1 = self.urihandler.get(self.hmc, '/api/logical-partitions/1',
                                     True)
-        self.assertEqual(lpar1['status'], 'not-activated')
+        assert lpar1['status'] == 'not-activated'
 
 
-class ResetActProfileHandlersTests(unittest.TestCase):
+class TestResetActProfileHandlers(object):
     """All tests for classes ResetActProfilesHandler and
     ResetActProfileHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/cpcs/([^/]+)/reset-activation-profiles(?:\?(.*))?',
@@ -4534,7 +4532,7 @@ class ResetActProfileHandlersTests(unittest.TestCase):
                 },
             ]
         }
-        self.assertEqual(raps, exp_raps)
+        assert raps == exp_raps
 
     def test_get(self):
 
@@ -4548,14 +4546,14 @@ class ResetActProfileHandlersTests(unittest.TestCase):
             'element-uri': '/api/cpcs/1/reset-activation-profiles/r1',
             'description': 'Reset profile #1 in CPC #1',
         }
-        self.assertEqual(rap1, exp_rap1)
+        assert rap1 == exp_rap1
 
 
-class ImageActProfileHandlersTests(unittest.TestCase):
+class TestImageActProfileHandlers(object):
     """All tests for classes ImageActProfilesHandler and
     ImageActProfileHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/cpcs/([^/]+)/image-activation-profiles/([^/]+)',
@@ -4580,7 +4578,7 @@ class ImageActProfileHandlersTests(unittest.TestCase):
                 },
             ]
         }
-        self.assertEqual(iaps, exp_iaps)
+        assert iaps == exp_iaps
 
     def test_get(self):
 
@@ -4594,14 +4592,14 @@ class ImageActProfileHandlersTests(unittest.TestCase):
             'element-uri': '/api/cpcs/1/image-activation-profiles/i1',
             'description': 'Image profile #1 in CPC #1',
         }
-        self.assertEqual(iap1, exp_iap1)
+        assert iap1 == exp_iap1
 
 
-class LoadActProfileHandlersTests(unittest.TestCase):
+class TestLoadActProfileHandlers(object):
     """All tests for classes LoadActProfilesHandler and
     LoadActProfileHandler."""
 
-    def setUp(self):
+    def setup_method(self):
         self.hmc, self.hmc_resources = standard_test_hmc()
         self.uris = (
             (r'/api/cpcs/([^/]+)/load-activation-profiles/([^/]+)',
@@ -4626,7 +4624,7 @@ class LoadActProfileHandlersTests(unittest.TestCase):
                 },
             ]
         }
-        self.assertEqual(laps, exp_laps)
+        assert laps == exp_laps
 
     def test_get(self):
 
@@ -4640,9 +4638,4 @@ class LoadActProfileHandlersTests(unittest.TestCase):
             'element-uri': '/api/cpcs/1/load-activation-profiles/L1',
             'description': 'Load profile #1 in CPC #1',
         }
-        self.assertEqual(lap1, exp_lap1)
-
-
-if __name__ == '__main__':
-    requests.packages.urllib3.disable_warnings()
-    unittest.main()
+        assert lap1 == exp_lap1