mirror of
https://github.com/evennia/evennia.git
synced 2026-03-22 15:56:30 +01:00
Increase coverage in BatchCodeProcessor.code_exec().
This commit is contained in:
parent
335dccabfd
commit
902c4e671a
1 changed files with 8 additions and 1 deletions
|
|
@ -183,10 +183,17 @@ class TestBatchCodeProcessor(TestCase):
|
|||
extra_environ={})
|
||||
self.assertIsNone(err)
|
||||
|
||||
@mock.patch('builtins.exec')
|
||||
def test_execs_codeblock_with_extra_environ(self, mocked_exec):
|
||||
err = batchprocessors.BATCHCODE.code_exec(
|
||||
'# batchcode code:\n\nprint("Hello")\n',
|
||||
extra_environ={'foo': 'bar', 'baz': True})
|
||||
self.assertIsNone(err)
|
||||
|
||||
@mock.patch('builtins.exec')
|
||||
def test_execs_codeblock_raises(self, mocked_exec):
|
||||
mocked_exec.side_effect = Exception
|
||||
err = batchprocessors.BATCHCODE.code_exec(
|
||||
'# batchcode code:\n\nprint("Hello")\n',
|
||||
'# batchcode code:\n\nprint("Hello")\nprint("Evennia")',
|
||||
extra_environ={})
|
||||
self.assertIsNotNone(err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue