Skip to content

Commit 710deaa

Browse files
committed
Move check for option sanity as discussed.
1 parent d6a8889 commit 710deaa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

nbval/plugin.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ def pytest_configure(config):
112112
from .nbdime_reporter import NbdimeReporter
113113
reporter = NbdimeReporter(config, sys.stdout)
114114
config.pluginmanager.register(reporter, 'nbdimereporter')
115+
if config.option.nbval or config.option.nbval_lax:
116+
if config.option.kernel_name and config.option.current_env:
117+
raise ValueError("--current-env and --kernel-name are mutually exclusive.")
118+
115119

116120

117121
def pytest_collect_file(path, parent):
@@ -232,8 +236,8 @@ def setup(self):
232236
Called by pytest to setup the collector cells in .
233237
Here we start a kernel and setup the sanitize patterns.
234238
"""
235-
if self.parent.config.option.kernel_name and self.parent.config.option.current_env:
236-
raise ValueError("--current-env and --kernel-name are mutually exclusive.")
239+
# we've already checked that --current-env and --kernel-name
240+
# were not both supplied
237241
if self.parent.config.option.current_env:
238242
kernel_name = CURRENT_ENV_KERNEL_NAME
239243
elif self.parent.config.option.kernel_name:

0 commit comments

Comments
 (0)