From e24588902f95f4ef407b0b4769a9b99b2faf6854 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Mon, 31 Oct 2016 15:11:56 -0700 Subject: [PATCH] Move test_os_server and apply fixes. - Add missing meta value for test_create_server - Add .gitignore for pytest .cache directory Exclude test_os_server from nose test runs since it was designed for pytest. The test will work correctly when run using pytest. This is a temporary issue, as we'll be moving to pytest soon. --- .gitignore | 1 + Makefile | 4 ++-- test/units/modules/core/cloud/openstack/__init__.py | 0 .../modules/core}/cloud/openstack/test_os_server.py | 4 +++- 4 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 test/units/modules/core/cloud/openstack/__init__.py rename test/{unit => units/modules/core}/cloud/openstack/test_os_server.py (98%) diff --git a/.gitignore b/.gitignore index 4ebacf429ab..756055b2a60 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,7 @@ credentials.yml *.out .coverage .tox +.cache results.xml coverage.xml /test/units/cover-html diff --git a/Makefile b/Makefile index 4dbede47224..6465b8bf530 100644 --- a/Makefile +++ b/Makefile @@ -106,10 +106,10 @@ NOSETESTS3 ?= nosetests-3.5 all: clean python tests: - PYTHONPATH=./lib $(NOSETESTS) -d -w test/units -v --with-coverage --cover-package=ansible --cover-branches --cover-erase + PYTHONPATH=./lib $(NOSETESTS) -d -w test/units -v --with-coverage --cover-package=ansible --cover-branches --cover-erase -e test_os_server tests-py3: - PYTHONPATH=./lib $(NOSETESTS3) -d -w test/units -v --with-coverage --cover-package=ansible --cover-branches --cover-erase + PYTHONPATH=./lib $(NOSETESTS3) -d -w test/units -v --with-coverage --cover-package=ansible --cover-branches --cover-erase -e test_os_server integration: test/utils/shippable/integration.sh diff --git a/test/units/modules/core/cloud/openstack/__init__.py b/test/units/modules/core/cloud/openstack/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/unit/cloud/openstack/test_os_server.py b/test/units/modules/core/cloud/openstack/test_os_server.py similarity index 98% rename from test/unit/cloud/openstack/test_os_server.py rename to test/units/modules/core/cloud/openstack/test_os_server.py index bb1f79ad2f9..a2c017edec2 100644 --- a/test/unit/cloud/openstack/test_os_server.py +++ b/test/units/modules/core/cloud/openstack/test_os_server.py @@ -4,7 +4,7 @@ import yaml import inspect import collections -from cloud.openstack import os_server +from ansible.modules.core.cloud.openstack import os_server class AnsibleFail(Exception): @@ -180,6 +180,8 @@ class TestCreateServer(object): flavor: m1.tiny nics: - net-name: network1 + meta: + - key: value ''' with pytest.raises(AnsibleExit): os_server._create_server(self.module, self.cloud)