Esempio n. 1
0
    def test_appends_new_test_classes_to_existing_test_files(self):
        TEST_CONTENTS = "class TestSomething: pass\n\n"
        module = inspect_code(self.project, "test_module.py", TEST_CONTENTS)

        add_tests_to_project(self.project, [self.module_path], 'unittest')

        assert_contains(module.get_content(), TEST_CONTENTS)
        assert_contains(module.get_content(), "class TestFunction(unittest.TestCase):")
 def _inspect_code(self, code):
     return inspect_code(EmptyProject(), "module.py", code)
Esempio n. 3
0
 def _init_project(self, module_code="", poe_content=""):
     self.project = ProjectInDirectory(self.tmpdir)
     putfile(self.project.path, "module.py", module_code)
     inspect_code(self.project, os.path.join(self.project.path, "module.py"), module_code)
     self.poe = PointOfEntryMock(self.project, content=poe_content)
Esempio n. 4
0
 def _test_module_from_code(self, code):
     return inspect_code(self.project, "test_module.py", code)
 def _test_module_from_code(self, code):
     return inspect_code(self.project, "test_module.py", code)
 def _inspect_code(self, code):
     return inspect_code(EmptyProject(), "module.py", code)
Esempio n. 7
0
 def _init_project(self, module_code="", poe_content=""):
     self.project = ProjectInDirectory(self.tmpdir)
     putfile(self.project.path, "module.py", module_code)
     inspect_code(self.project, os.path.join(self.project.path, "module.py"), module_code)
     self.poe = PointOfEntryMock(self.project, content=poe_content)