mirror of
https://github.com/ansible/awx.git
synced 2026-04-04 01:35:11 -02:30
support the new CLI in py2 *and* py3
This commit is contained in:
@@ -50,8 +50,14 @@ def test_list_resources(capfd, resource):
|
||||
cli.parse_args(['awx {}'.format(resource)])
|
||||
cli.connect()
|
||||
|
||||
cli.parse_resource()
|
||||
out, err = capfd.readouterr()
|
||||
try:
|
||||
cli.parse_resource()
|
||||
out, err = capfd.readouterr()
|
||||
except SystemExit:
|
||||
# python2 argparse raises SystemExit for invalid/missing required args,
|
||||
# py3 doesn't
|
||||
_, out = capfd.readouterr()
|
||||
|
||||
assert "usage:" in out
|
||||
for snippet in (
|
||||
'--conf.host https://example.awx.org]',
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import argparse
|
||||
import json
|
||||
import unittest
|
||||
from io import StringIO
|
||||
try:
|
||||
from StringIO import StringIO
|
||||
except ImportError:
|
||||
from io import StringIO
|
||||
|
||||
import pytest
|
||||
from requests import Response
|
||||
|
||||
Reference in New Issue
Block a user