Skip to content

Commit

Permalink
Suppress warning text (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-hellings authored Oct 30, 2021
1 parent 5024018 commit fd9a25c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
2 changes: 0 additions & 2 deletions src/tox_ansible/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ def tox_configure(config):
config.envlist = list(config.envconfigs.keys())
config.envlist.sort()
config.envlist_default = config.envlist
if len(config.envlist) == 0:
logging.error("tox-ansible found no matching environments")


except ImportError:
Expand Down
23 changes: 15 additions & 8 deletions tests/test_everything.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ def run_tox(args, capture):
except SystemExit as s:
if s.code != 0:
raise
outs = capture.readouterr()
return outs.out.strip()
out, err = capture.readouterr()
return out.strip(), err.strip()


@pytest.mark.parametrize(
Expand All @@ -123,14 +123,21 @@ def run_tox(args, capture):
)
def test_run_tox(directory, capfd):
with cd(directory):
out = run_tox(["-l"], capfd)
out, _ = run_tox(["-l"], capfd)
assert out == EXPECTED[directory]


def test_no_results(capfd):
with cd("tests/fixtures/collection"):
out, err = run_tox(["-l", "--ansible-driver", "derp"], capfd)
assert out == ""
assert err == ""


def test_tox_ini_deps_preserved(capfd):
with cd("tests/fixtures/has_deps"):
lint_out = run_tox(["--showconfig", "-e", "lint_all"], capfd)
simple_out = run_tox(["--showconfig", "-e", "roles-simple-default"], capfd)
lint_out, _ = run_tox(["--showconfig", "-e", "lint_all"], capfd)
simple_out, _ = run_tox(["--showconfig", "-e", "roles-simple-default"], capfd)
deps = [m for m in lint_out.split("\n") if m.startswith("deps = ")][0]
assert "notadep==1" in deps
deps = [m for m in simple_out.split("\n") if m.startswith("deps = ")][0]
Expand All @@ -144,9 +151,9 @@ def test_tox_ini_deps_preserved(capfd):
def test_run_tox_with_args(target, value, capfd):
args = ["-l", "--ansible-{}".format(target), value]
with cd("tests/fixtures/collection"):
cli = run_tox(args, capfd)
cli, _ = run_tox(args, capfd)
with patch.dict("os.environ", {"TOX_ANSIBLE_{}".format(target.upper()): value}):
env = run_tox(["-l"], capfd)
env, _ = run_tox(["-l"], capfd)
assert cli == EXPECTED_ARGS[value]
assert env == EXPECTED_ARGS[value]

Expand All @@ -158,7 +165,7 @@ def test_run_with_test_command(capfd):
shutil.rmtree(".tox")
except FileNotFoundError:
pass
cli = run_tox(["-e", "roles-simple-default"], capfd)
cli, _ = run_tox(["-e", "roles-simple-default"], capfd)
assert (
"roles-simple-default: commands succeeded" in cli
), f"Important text missing from {cli}"

0 comments on commit fd9a25c

Please sign in to comment.