Skip to content

Commit d185326

Browse files
committed
Update tests as in this branch BaseConfig has 2 required values, so we use test_project_config_factory instead
1 parent 8c82930 commit d185326

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

test/unit/config_test.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,22 +142,26 @@ def prepare_release_update_version(self, session, config, version: Version) -> N
142142

143143
class TestPlugins:
144144
@staticmethod
145-
def test_works_when_empty():
146-
BaseConfig(plugins_for_nox_sessions=())
145+
def test_works_when_empty(test_project_config_factory):
146+
test_project_config_factory(plugins_for_nox_sessions=())
147147

148148
@staticmethod
149-
def test_works_for_hook(capsys):
150-
BaseConfig(plugins_for_nox_sessions=(WithHook,))
149+
def test_works_for_hook(test_project_config_factory, capsys):
150+
test_project_config_factory(plugins_for_nox_sessions=(WithHook,))
151151

152152
@staticmethod
153-
def test_raises_exception_method_with_hook_not_specified():
153+
def test_raises_exception_method_with_hook_not_specified(
154+
test_project_config_factory,
155+
):
154156
with pytest.raises(ValidationError) as ex:
155-
BaseConfig(plugins_for_nox_sessions=(WithNotSpecifiedHook,))
157+
test_project_config_factory(
158+
plugins_for_nox_sessions=(WithNotSpecifiedHook,)
159+
)
156160
assert "1 method(s) were decorated with `@hookimpl`, but" in str(ex.value)
157161
assert "('not_specified_anywhere',)" in str(ex.value)
158162

159163
@staticmethod
160-
def test_raises_exception_without_hook():
164+
def test_raises_exception_without_hook(test_project_config_factory):
161165
with pytest.raises(ValidationError) as ex:
162-
BaseConfig(plugins_for_nox_sessions=(WithoutHook,))
166+
test_project_config_factory(plugins_for_nox_sessions=(WithoutHook,))
163167
assert "No methods in `WithoutHook`" in str(ex.value)

0 commit comments

Comments
 (0)