Skip to content

Commit

Permalink
Workaround tests that fail because they violate type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
gschaffner authored and henryiii committed Sep 9, 2024
1 parent e423fd3 commit d8022dd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/test__parametrize.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def f():
def test_generate_calls_simple():
f = mock.Mock(should_warn={}, tags=[])
f.__name__ = "f"
f.requires = None
f.some_prop = 42

arg_names = ("abc",)
Expand Down Expand Up @@ -199,6 +200,7 @@ def test_generate_calls_simple():
def test_generate_calls_multiple_args():
f = mock.Mock(should_warn=None, tags=None)
f.__name__ = "f"
f.requires = None

arg_names = ("foo", "abc")
call_specs = [
Expand All @@ -225,6 +227,7 @@ def test_generate_calls_multiple_args():
def test_generate_calls_ids():
f = mock.Mock(should_warn={}, tags=[])
f.__name__ = "f"
f.requires = None

arg_names = ("foo",)
call_specs = [
Expand Down
7 changes: 7 additions & 0 deletions tests/test_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,7 @@ def make_runner(self):
func.python = None
func.venv_backend = None
func.reuse_venv = False
func.requires = []
runner = nox.sessions.SessionRunner(
name="test",
signatures=["test(1, 2)"],
Expand Down Expand Up @@ -1157,6 +1158,7 @@ def test_execute_quit(self):
def func(session):
session.error("meep")

func.requires = []
runner.func = func

result = runner.execute()
Expand All @@ -1169,6 +1171,7 @@ def test_execute_skip(self):
def func(session):
session.skip("meep")

func.requires = []
runner.func = func

result = runner.execute()
Expand Down Expand Up @@ -1226,6 +1229,7 @@ def test_execute_failed(self):
def func(session):
raise nox.command.CommandFailed()

func.requires = []
runner.func = func

result = runner.execute()
Expand All @@ -1238,6 +1242,7 @@ def test_execute_interrupted(self):
def func(session):
raise KeyboardInterrupt()

func.requires = []
runner.func = func

with pytest.raises(KeyboardInterrupt):
Expand All @@ -1249,6 +1254,7 @@ def test_execute_exception(self):
def func(session):
raise ValueError("meep")

func.requires = []
runner.func = func

result = runner.execute()
Expand All @@ -1266,6 +1272,7 @@ def func(session):
f' os.environ["NOX_CURRENT_SESSION"] == {session.name!r} else 0)',
)

func.requires = []
runner.func = func

result = runner.execute()
Expand Down
2 changes: 2 additions & 0 deletions tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def session_func():
session_func.should_warn = {}
session_func.tags = []
session_func.default = True
session_func.requires = []


def session_func_with_python():
Expand All @@ -50,6 +51,7 @@ def session_func_with_python():
session_func_with_python.python = "3.8"
session_func_with_python.venv_backend = None
session_func_with_python.default = True
session_func_with_python.requires = []


def session_func_venv_pythons_warning():
Expand Down

0 comments on commit d8022dd

Please sign in to comment.