def test_run(self): with Stub() as selector: selector.wantFile(any()) >> False with Stub() as run: from nose.core import run run(argv=any(), addplugins=any()) >> True runner = MutationRunner(mutations_path='/mutations/path', test_selector=selector) runner.run(None)
def xtest_want_mutation_emptyfile(self): with Stub() as selector: selector.wantFile(any()) >> False with Stub() as exists: from os.path import exists exists(any()) >> True with Stub() as getsize: from os.path import getsize getsize(any()) >> 0 getsize(any()) >> 1024 runner = MutationRunner(mutations_path='/mutations/path', test_selector=selector) self.assertFalse(runner.wantMutation('/mutations/path/submodule/module.py')) self.assertTrue(runner.wantMutation('/mutations/path/submodule/module.py')) exists.restore_import() getsize.restore_import()
def set_edited_content(self, string): with Stub() as edit_entry: from edit_entry import invoke_editor invoke_editor(any(), any()) >> string
def test_want_mutation_nonexistent_file(self): with Stub() as selector: selector.wantFile(any()) >> False runner = MutationRunner(mutations_path='/mutations/path', test_selector=selector) self.assertFalse(runner.want_mutation('/mutations/path/submodule/module.py'))