Enable most unittests on python3 (just some vault unittests and a logging one left) (#17240)

Make some python3 fixes to make the unittests pass:

* galaxy imports
* dictionary iteration in role requirements
* swap_stdout helper for unittests
* Normalize to text string in a facts.py function
This commit is contained in:
Toshio Kuratomi 2016-08-25 07:30:03 -07:00 committed by GitHub
commit 44d979c8f5
11 changed files with 23 additions and 29 deletions

View file

@ -39,7 +39,7 @@ from ansible.galaxy.role import GalaxyRole
from ansible.galaxy.login import GalaxyLogin
from ansible.galaxy.token import GalaxyToken
from ansible.playbook.role.requirement import RoleRequirement
from ansible.utils.unicode import to_unicode
from ansible.utils.unicode import to_bytes, to_unicode
try:
from __main__ import display
@ -193,7 +193,7 @@ class GalaxyCLI(CLI):
os.makedirs(role_path)
readme_path = os.path.join(role_path, "README.md")
f = open(readme_path, "wb")
f.write(self.galaxy.default_readme)
f.write(to_bytes(self.galaxy.default_readme))
f.close()
# create default .travis.yml