vals = subconfig.get(fn + 's', [])
metafunc.parametrize(fn, vals)
-@pytest.fixture(scope='session')
+@pytest.fixture(scope='function')
def u_boot_console(request):
'''Generate the value of a test's u_boot_console fixture.
The fixture value.
'''
+ console.ensure_spawned()
return console
tests_not_run = set()
return var
n += 1
-@pytest.fixture(scope='module')
+ste = None
+@pytest.fixture(scope='function')
def state_test_env(u_boot_console):
'''pytest fixture to provide a StateTestEnv object to tests.'''
- return StateTestEnv(u_boot_console)
+ global ste
+ if not ste:
+ ste = StateTestEnv(u_boot_console)
+ return ste
def unset_var(state_test_env, var):
'''Unset an environment variable.
u_boot_console.run_command('reset', wait_for_prompt=False)
assert(u_boot_console.validate_exited())
- u_boot_console.ensure_spawned()
@pytest.mark.boardspec('sandbox')
def test_ctrl_c(u_boot_console):
u_boot_console.kill(signal.SIGINT)
assert(u_boot_console.validate_exited())
- u_boot_console.ensure_spawned()
'''Test the sleep command, and validate that it sleeps for approximately
the correct amount of time.'''
- # Do this before we time anything, to make sure U-Boot is already running.
- # Otherwise, the system boot time is included in the time measurement.
- u_boot_console.ensure_spawned()
-
# 3s isn't too long, but is enough to cross a few second boundaries.
sleep_time = 3
tstart = time.time()
command string and emitted the subsequent command prompts.
'''
- self.ensure_spawned()
-
if self.at_prompt and \
self.at_prompt_logevt != self.logstream.logfile.cur_evt:
self.logstream.write(self.prompt, implicit=True)
Nothing.
'''
- self.ensure_spawned()
self.log.action('kill %d' % sig)
self.p.kill(sig)