def test_discover_nothing(self): tests.set_cwd_to_tmp(self) with open('foo', 'w') as f: f.write('bar\n') file_loader = loader.FileLoader(self.get_test_loader()) suite = file_loader.discover('.', 'foo') self.assertIs(None, suite)
def test_sys_path_restored(self): tests.set_cwd_to_tmp(self) inserted = self.test_base_dir self.assertFalse(inserted in sys.path) class Test(testtools.TestCase): def test_it(self): tests.protect_imports(self) sys.path.insert(0, inserted) self.run_successful_test(Test('test_it')) self.assertFalse(inserted in sys.path)
def setUp(self): super(TestTestLoaderTopLevelDir, self).setUp() # We build trees rooted in test_base_dir from which we will import tests.set_cwd_to_tmp(self) tests.protect_imports(self) tests.write_tree_from_desc('''dir: t file: t/__init__.py file: t/foo.py import unittest class Test(unittest.TestCase): def test_me(self): self.assertTrue(True) ''') self.loader = loaders.TestLoader()
def setUp(self): super(TestConsoleOutput, self).setUp() tests.set_cwd_to_tmp(self)
def setUp(self): super(TestXmlOutput, self).setUp() tests.set_cwd_to_tmp(self)
def setUp(self): super(TestDjangoDevServer, self).setUp() # capture test output so we don't pollute the test runs self.out = StringIO() self.patch(sys, 'stdout', self.out) tests.set_cwd_to_tmp(self)
def setUp(self): super(TestScreenShotsAndPageDump, self).setUp() tests.set_cwd_to_tmp(self) # capture test output so we don't pollute the test runs self.out = StringIO() self.patch(sys, 'stdout', self.out)
def setUp(self): super(TestWriteTree, self).setUp() tests.set_cwd_to_tmp(self)
def setUp(self): super(TestHandleExceptions, self).setUp() tests.set_cwd_to_tmp(self) self.result = testtools.TestResult()
def setUp(self): super(TestDjangoDevServer, self).setUp() # We should not rely on the current directory being the root of the sst # project, the best way to achieve that is to change to a newly created # one. tests.set_cwd_to_tmp(self)
def setUp(self): super(TestSSTScriptTestCaseFailureScreenShots, self).setUp() tests.set_cwd_to_tmp(self) # capture test output so we don't pollute the test runs self.out = StringIO() self.patch(sys, "stdout", self.out)
def setUp(self): super(TestTestLoaderTopLevelDir, self).setUp() # We build trees rooted in test_base_dir from which we will import tests.set_cwd_to_tmp(self) tests.protect_imports(self)
def setUp(self): super(TestLoadScript, self).setUp() tests.set_cwd_to_tmp(self)
def setUp(self): super(TestFindCases, self).setUp() tests.set_cwd_to_tmp(self) self.cases_dir = os.path.join(self.test_base_dir, 'cases')
def setUp(self): super(TestResultsDirectory, self).setUp() tests.set_cwd_to_tmp(self)
def setUp(self): super(TestSSTTestCase, self).setUp() tests.set_cwd_to_tmp(self) self.test = tests.SSTBrowserLessTestCase('run') self.result = testtools.TestResult() self.test.run(self.result)