Classifying tests into functional and unit

As defined on the planning of sprint 2016-2, we'll maintain unit and functional
tests in separate directories and have a tox environment to run functional
tests. This patch re-configures the environment of tox and re-arrange the
testing modules.

Change-Id: I8ad43e73fb627c2881e50bef426e34eb989b3858
This commit is contained in:
Thiago Paiva 2016-03-01 16:36:05 -03:00
parent f4816b6837
commit e5fd3873b6
7 changed files with 19 additions and 4 deletions

View File

@ -2,6 +2,6 @@
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION
${PYTHON:-python} -m subunit.run discover -t ./ ${TESTS_DIR:-./oneview_client/tests/unit} $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

View File

@ -732,19 +732,24 @@ class OneViewClientTestCase(unittest.TestCase):
driver_info
)
@mock.patch.object(client.Client, 'get_server_hardware_by_uuid',
autospec=True)
@mock.patch.object(client.Client, 'get_server_hardware',
autospec=True)
def test_is_node_port_mac_compatible_with_server_hardware(
self, mock_server_hardware, mock__authenticate
self, mock_server_hardware, mock_server_hardware_by_uuid,
mock__authenticate
):
server_hardware_mock = ServerHardware()
setattr(server_hardware_mock, "uri", "/anyuri")
setattr(server_hardware_mock, "uuid", "1111-2222-3333")
server_hardware_mock_port_map = PORT_MAP
setattr(server_hardware_mock,
"port_map",
server_hardware_mock_port_map)
mock_server_hardware.return_value = server_hardware_mock
mock_server_hardware_by_uuid.return_value = server_hardware_mock
oneview_client = client.Client(self.manager_url,
self.username,
@ -757,19 +762,24 @@ class OneViewClientTestCase(unittest.TestCase):
mock_server_hardware.assert_called_once_with(oneview_client, {})
@mock.patch.object(client.Client, 'get_server_hardware_by_uuid',
autospec=True)
@mock.patch.object(client.Client, 'get_server_hardware',
autospec=True)
def test_is_node_port_mac_incompatible_with_server_hardware(
self, mock_server_hardware, mock__authenticate
self, mock_server_hardware, mock_server_hardware_by_uuid,
mock__authenticate
):
server_hardware_mock = ServerHardware()
setattr(server_hardware_mock, "uri", "/anyuri")
setattr(server_hardware_mock, "uuid", "1111-2222-3333")
server_hardware_mock_port_map = PORT_MAP
setattr(server_hardware_mock,
"port_map",
server_hardware_mock_port_map)
mock_server_hardware.return_value = server_hardware_mock
mock_server_hardware_by_uuid.return_value = server_hardware_mock
exc_expected_msg = (
"The ports of the node are not compatible with its server hardware"
@ -1091,5 +1101,6 @@ class OneViewClientTestCase(unittest.TestCase):
ports
)
if __name__ == '__main__':
unittest.main()

View File

@ -27,7 +27,11 @@ commands = python setup.py build_sphinx
commands = oslo_debug_helper {posargs}
[flake8]
# E123, E125 skipped as they are invalid PEP-8.
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools
[testenv:functional]
setenv = TESTS_DIR=./oneview_client/tests/functional
LANGUAGE=en_US
show-source = True
ignore = E123,E125