def setUpCase(self): content = """ def hello(): return "hello" def tutu(): return "tutu" """ module = test_NoseXUnit.Module('foo_1', content) module.save(self.source) content = """ def tata(): return "tata" def toto(): return 'foo' #pragma: no cover """ module = test_NoseXUnit.Module('foo_2', content) module.save(self.source) content = """ import foo_1 self.assertEquals('hello', foo_1.hello()) """ test = test_NoseXUnit.TestModule('test_foo', 'TestFoo') test.addCustom('test', content) test.save(self.source) self.suitepath = self.source self.setUpCore(self.core_target, self.source) self.setUpCover(self.cover_target, clean=False, collect=False)
def test_double(self): f = test_NoseXUnit.Folder('folder') m_1 = test_NoseXUnit.Module('foo') f.append(m_1) f.save(self.source) m_2 = test_NoseXUnit.Module('foo').save(self.source) expected = {m_2.desc(): m_2.path(), } self.assertEqual(expected, ntools.packages(self.source, search=True, exclude=[]))
def test_package_module(self): p = test_NoseXUnit.Package('foo_1') m = test_NoseXUnit.Module('foo_2') p.append(m) p.save(self.source) expected = {p.full(): p.path(), m.full(): m.path(), } self.assertEqual(expected, ntools.packages(self.source, search=True, exclude=[]))
def setUpCase(self): content = """ class TestFileName(object): def test(self): yield self._test_body, '/toto.\\tata.tutu.bug' def _test_body(self, path): pass """ test = test_NoseXUnit.Module('test_file_name', content) test.save(self.source) self.suitepath = self.source self.setUpCore(self.core_target, self.source)
def setUpCase(self): content = """ class TestYieldError(object): def test(self): yield self._test_body, yoo def _test_body(self): pass """ test = test_NoseXUnit.Module('test_yield', content) test.save(self.source) self.suitepath = self.source self.setUpCore(self.core_target, self.source)
def setUpCase(self): content = """ def hello(): return "hello" """ package = test_NoseXUnit.Package('foo_1') package.append(test_NoseXUnit.Module('foo_2', content)) package.save(self.source) self.suitepath = self.source self.setUpCore(self.core_target, self.source) self.setUpAudit(self.audit_target)
def setUpCase(self): content = """ def hello(): return "hello" """ module = test_NoseXUnit.Module('foo', content) module.save(self.source) os.chmod(module.path(), stat.S_IREAD) content = """ import foo self.assertEquals('hello', foo.hello()) """ test = test_NoseXUnit.TestModule('test_foo', 'TestFoo') test.addCustom('test', content) test.save(self.source) self.suitepath = self.source self.setUpCore(self.core_target, self.source) self.setUpCover(self.cover_target, clean=False, collect=False)
def test_exclude(self): f = test_NoseXUnit.Folder('CVS') m = test_NoseXUnit.Module('foo') f.append(m) f.save(self.source) self.assertEqual({}, ntools.packages(self.source, search=True, exclude=['CVS', ]))
def test_no_search(self): f = test_NoseXUnit.Folder('folder') m = test_NoseXUnit.Module('foo') f.append(m) f.save(self.source) self.assertEqual({}, ntools.packages(self.source, search=False, exclude=[]))
def test_module(self): m = test_NoseXUnit.Module('foo').save(self.source) expected = {'foo': m.path(), } self.assertEqual(expected, ntools.packages(self.source, search=False, exclude=[]))
def test_module_in_package(self): p = test_NoseXUnit.Package('foo_1') m = test_NoseXUnit.Module('foo_2') p.append(m) p.save(self.source) self.assertPackage(m)
def test_module(self): self.assertPackage(test_NoseXUnit.Module('foo').save(self.source))