Skip to content

Commit

Permalink
Merge pull request #302 from Carreau/untested-tests
Browse files Browse the repository at this point in the history
Rename test that were never ran.
  • Loading branch information
Carreau authored Feb 13, 2024
2 parents af84c71 + 300ac9d commit a13a5bd
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions tests/test_autoimp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1740,13 +1740,19 @@ def test_load_symbol_missing_2():
load_symbol("os.path.join", {})


def load_symbol_eval_1():
@pytest.mark.xfail(
strict=True, reason="old test that was not names with test_ and never passed"
)
def test_load_symbol_eval_1():
assert 'a/b' == load_symbol("os.path.join('a','b')", {"os": os})
assert '/' == load_symbol("os.path.join('a','b')[1]", {"os": os})
assert 'A' == load_symbol("os.path.join('a','b')[0].upper()", {"os": os})


def load_symbol_eval_2(capsys):
@pytest.mark.xfail(
strict=True, reason="old test that was not names with test_ and never passed"
)
def test_load_symbol_eval_2(capsys):
assert '/' == load_symbol("(os.path.sep[0])", {}, autoimport=True,
allow_eval=True)
out, _ = capsys.readouterr()
Expand All @@ -1756,7 +1762,7 @@ def load_symbol_eval_2(capsys):
assert expected == out


def load_symbol_no_eval_1():
def test_load_symbol_no_eval_1():
with pytest.raises(LoadSymbolError):
load_symbol("os.path.join('a','b')", {"os": os})
with pytest.raises(LoadSymbolError):
Expand All @@ -1765,7 +1771,7 @@ def load_symbol_no_eval_1():
load_symbol("os.path.join('a','b')[0].upper", {"os": os})


def load_symbol_wrap_exc_1():
def test_load_symbol_wrap_exc_1():
class Foo89503828(object):
def __getattr__(self, k):
1/0
Expand All @@ -1778,9 +1784,13 @@ def __getattr__(self, k):
assert False


def load_symbol_wrap_exc_eval_1():
@pytest.mark.xfail(
strict=True, reason="old test that was not names with test_ and never passed"
)
def test_load_symbol_wrap_exc_eval_1():
def foo31617859():
1/0
return 1 / 0

ns = [{"foo": foo31617859()}]
try:
load_symbol("foo()", ns, auto_eval=True)
Expand All @@ -1790,7 +1800,10 @@ def foo31617859():
assert False


def load_symbol_wrap_exc_eval_getattr_1():
@pytest.mark.xfail(
strict=True, reason="old test that was not names with test_ and never passed"
)
def test_load_symbol_wrap_exc_eval_getattr_1():
class Foo15356301(object):
def __getattr__(self, k):
1/0
Expand Down

0 comments on commit a13a5bd

Please sign in to comment.