Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
a9542209
Commit
a9542209
authored
Oct 21, 2014
by
Toshio Kuratomi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate the v2/tests to use the ansible.compat module
parent
3f27e5e0
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
9 additions
and
64 deletions
+9
-64
v2/test/compat.py
+0
-56
v2/test/errors/test_errors.py
+3
-2
v2/test/parsing/test_general.py
+1
-1
v2/test/parsing/test_mod_args.py
+1
-1
v2/test/parsing/yaml/test_yaml.py
+1
-1
v2/test/playbook/test_block.py
+1
-1
v2/test/playbook/test_role.py
+1
-1
v2/test/playbook/test_task.py
+1
-1
No files found.
v2/test/compat.py
deleted
100644 → 0
View file @
3f27e5e0
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# Make coding more python3-ish
from
__future__
import
(
absolute_import
,
division
,
print_function
)
__metaclass__
=
type
import
sys
import
unittest
#
# Compat for python2.6
#
if
sys
.
version_info
<
(
2
,
7
):
try
:
# Need unittest2 on python2.6
import
unittest2
as
unittest
except
ImportError
:
print
(
'You need unittest2 installed on python2.x'
)
else
:
import
unittest
#
# Compat for python2.7
#
# Could use the pypi mock library on py3 as well as py2. They are the same
try
:
from
unittest.mock
import
mock_open
,
patch
except
ImportError
:
# Python2
from
mock
import
mock_open
,
patch
try
:
import
__builtin__
except
ImportError
:
BUILTINS
=
'builtins'
else
:
BUILTINS
=
'__builtin__'
v2/test/errors/test_errors.py
View file @
a9542209
...
@@ -19,12 +19,13 @@
...
@@ -19,12 +19,13 @@
from
__future__
import
(
absolute_import
,
division
,
print_function
)
from
__future__
import
(
absolute_import
,
division
,
print_function
)
__metaclass__
=
type
__metaclass__
=
type
from
..
compat
import
unittest
from
ansible.compat.tests
import
unittest
from
ansible.parsing.yaml.objects
import
AnsibleBaseYAMLObject
from
ansible.parsing.yaml.objects
import
AnsibleBaseYAMLObject
from
ansible.errors
import
AnsibleError
from
ansible.errors
import
AnsibleError
from
..
compat
import
BUILTINS
,
mock_open
,
patch
from
ansible.compat.tests
import
BUILTINS
from
ansible.compat.tests.mock
import
mock_open
,
patch
class
TestErrors
(
unittest
.
TestCase
):
class
TestErrors
(
unittest
.
TestCase
):
...
...
v2/test/parsing/test_general.py
View file @
a9542209
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
from
__future__
import
(
absolute_import
,
division
,
print_function
)
from
__future__
import
(
absolute_import
,
division
,
print_function
)
__metaclass__
=
type
__metaclass__
=
type
from
..
compat
import
unittest
from
ansible.compat.tests
import
unittest
from
ansible.parsing
import
load_data
from
ansible.parsing
import
load_data
from
ansible.errors
import
AnsibleParserError
from
ansible.errors
import
AnsibleParserError
...
...
v2/test/parsing/test_mod_args.py
View file @
a9542209
...
@@ -21,7 +21,7 @@ __metaclass__ = type
...
@@ -21,7 +21,7 @@ __metaclass__ = type
from
ansible.parsing.mod_args
import
ModuleArgsParser
from
ansible.parsing.mod_args
import
ModuleArgsParser
from
..
compat
import
unittest
from
ansible.compat.tests
import
unittest
class
TestModArgsDwim
(
unittest
.
TestCase
):
class
TestModArgsDwim
(
unittest
.
TestCase
):
...
...
v2/test/parsing/yaml/test_yaml.py
View file @
a9542209
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
from
__future__
import
(
absolute_import
,
division
,
print_function
)
from
__future__
import
(
absolute_import
,
division
,
print_function
)
__metaclass__
=
type
__metaclass__
=
type
from
...
compat
import
unittest
from
ansible.compat.tests
import
unittest
from
yaml.scanner
import
ScannerError
from
yaml.scanner
import
ScannerError
...
...
v2/test/playbook/test_block.py
View file @
a9542209
...
@@ -21,7 +21,7 @@ __metaclass__ = type
...
@@ -21,7 +21,7 @@ __metaclass__ = type
from
ansible.playbook.block
import
Block
from
ansible.playbook.block
import
Block
from
ansible.playbook.task
import
Task
from
ansible.playbook.task
import
Task
from
..
compat
import
unittest
from
ansible.compat.tests
import
unittest
class
TestBlock
(
unittest
.
TestCase
):
class
TestBlock
(
unittest
.
TestCase
):
...
...
v2/test/playbook/test_role.py
View file @
a9542209
...
@@ -22,7 +22,7 @@ __metaclass__ = type
...
@@ -22,7 +22,7 @@ __metaclass__ = type
from
ansible.playbook.block
import
Block
from
ansible.playbook.block
import
Block
from
ansible.playbook.role
import
Role
from
ansible.playbook.role
import
Role
from
ansible.playbook.task
import
Task
from
ansible.playbook.task
import
Task
from
..
compat
import
unittest
from
ansible.compat.tests
import
unittest
class
TestRole
(
unittest
.
TestCase
):
class
TestRole
(
unittest
.
TestCase
):
...
...
v2/test/playbook/test_task.py
View file @
a9542209
...
@@ -20,7 +20,7 @@ from __future__ import (absolute_import, division, print_function)
...
@@ -20,7 +20,7 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__
=
type
__metaclass__
=
type
from
ansible.playbook.task
import
Task
from
ansible.playbook.task
import
Task
from
..
compat
import
unittest
from
ansible.compat.tests
import
unittest
basic_shell_task
=
dict
(
basic_shell_task
=
dict
(
name
=
'Test Task'
,
name
=
'Test Task'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment