Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pytest fail when tests marked as xfail pass #1280

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ minversion = 3.6
markers =
bashcomp
complete
xfail_strict=true
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want this, I think we also want/need to go all things that can be xfails or xpasses, and mark them as such, specifically on per distro basis (i.e. semantically for example like "expected to fail on CentOS 7").

We could also consider changing some xfails to skips, but to me the downside of that would be that we'd get no indication if something that used to fail has started to pass due to something (which xpass gives us). There might be some skips that we'd want to convert to xfails for this reason.


[mypy]
python_version = 3.6
Expand Down
1 change: 0 additions & 1 deletion test/t/test_alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class TestAlias:
def test_1(self, completion):
assert completion == "bar foo".split()

@pytest.mark.xfail # TODO: Would like this completion to work
@pytest.mark.complete("alias foo=")
def test_2(self, completion):
assert completion == "foo='bar'"
Expand Down
4 changes: 1 addition & 3 deletions test/t/test_mkdir.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ def test_1(self, completion):
def test_2(self, completion):
assert completion == ["bar", "bar bar.d/", "foo", "foo.d/"]

@pytest.mark.xfail # TODO: why path in completion, basename in .output?
@pytest.mark.complete("mkdir shared/default/foo.d/")
def test_3(self, completion):
assert completion.output == "foo"
assert completion == [completion.output]
assert completion == ["foo"]

@pytest.mark.complete("mkdir -", require_longopt=True)
def test_options(self, completion):
Expand Down
1 change: 0 additions & 1 deletion test/t/unit/test_unit_compgen_filedir.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ def test_26(self, bash, functions, funcname):
)
assert completion == 'h"'

@pytest.mark.xfail(reason="TODO: non-ASCII issues with test suite?")
@pytest.mark.parametrize("funcname", "f f2".split())
def test_27(self, bash, functions, funcname, utf8_ctype):
completion = assert_complete(bash, "%s aé/" % funcname, cwd="_filedir")
Expand Down
3 changes: 1 addition & 2 deletions test/t/unit/test_unit_compgen_ip_addresses.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from conftest import assert_bash_exec, in_container
from conftest import assert_bash_exec


@pytest.mark.bashcomp(cmd=None, ignore_env=r"^\+COMPREPLY=")
Expand Down Expand Up @@ -41,7 +41,6 @@ def test_3(self, functions, completion):
assert completion
assert all("." in x for x in completion)

@pytest.mark.xfail(in_container(), reason="Probably fails in a container")
@pytest.mark.complete("ia6 ")
def test_4(self, functions, completion):
"""_comp_compgen_ip_addresses -6 should complete ipv6 addresses."""
Expand Down
1 change: 0 additions & 1 deletion test/t/unit/test_unit_get_cword.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ def test_23(self, bash):
output = self._test(bash, '(a "\'b&c")', 1, "a 'b&c", 6)
assert output == "'b&c"

@pytest.mark.xfail(reason="TODO: non-ASCII issues with test suite?")
def test_24(self, bash):
"""Index shouldn't drop below 0"""
bash.send("scp ääää§ se\t\r\n")
Expand Down
Loading