/
usr
/
lib
/
python3
/
dist-packages
/
twisted
/
trial
/
test
/
/usr/lib/python3/dist-packages/twisted/trial/test
mkdir
upload
Name
Size
Mode
Actions
__pycache__/
-
0755
rm
detests.py
5667
0644
edit
dl
rm
erroneous.py
4792
0644
edit
dl
rm
mockcustomsuite.py
536
0644
edit
dl
rm
mockcustomsuite2.py
533
0644
edit
dl
rm
mockcustomsuite3.py
676
0644
edit
dl
rm
mockdoctest.py
2421
0644
edit
dl
rm
moduleself.py
170
0644
edit
dl
rm
moduletest.py
302
0644
edit
dl
rm
novars.py
182
0644
edit
dl
rm
ordertests.py
864
0644
edit
dl
rm
packages.py
4651
0644
edit
dl
rm
sample.py
2084
0644
edit
dl
rm
scripttest.py
457
0755
edit
dl
rm
skipping.py
5709
0644
edit
dl
rm
suppression.py
2499
0644
edit
dl
rm
test_assertions.py
60813
0644
edit
dl
rm
test_asyncassertions.py
2552
0644
edit
dl
rm
test_deferred.py
8822
0644
edit
dl
rm
test_doctest.py
1713
0644
edit
dl
rm
test_keyboard.py
3784
0644
edit
dl
rm
test_loader.py
22360
0644
edit
dl
rm
test_log.py
8040
0644
edit
dl
rm
test_output.py
5016
0644
edit
dl
rm
test_plugins.py
1460
0644
edit
dl
rm
test_pyunitcompat.py
7620
0644
edit
dl
rm
test_reporter.py
56709
0644
edit
dl
rm
test_runner.py
35040
0644
edit
dl
rm
test_script.py
29377
0644
edit
dl
rm
test_skip.py
2651
0644
edit
dl
rm
test_suppression.py
5911
0644
edit
dl
rm
test_testcase.py
1985
0644
edit
dl
rm
test_tests.py
49500
0644
edit
dl
rm
test_util.py
19660
0644
edit
dl
rm
test_warning.py
17638
0644
edit
dl
rm
weird.py
675
0644
edit
dl
rm
__init__.py
130
0644
edit
dl
rm
Edit:
/usr/lib/python3/dist-packages/twisted/trial/test/test_output.py
(5016B)
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Tests for the output generated by trial. """ import os from io import StringIO from twisted.scripts import trial from twisted.trial import runner from twisted.trial.test import packages _noModuleError = "No module named 'frotz'" def runTrial(*args): from twisted.trial import reporter config = trial.Options() config.parseOptions(args) output = StringIO() myRunner = runner.TrialRunner( reporter.VerboseTextReporter, stream=output, workingDirectory=config["temp-directory"], ) suite = trial._getSuite(config) myRunner.run(suite) return output.getvalue() class ImportErrorsTests(packages.SysPathManglingTest): """Actually run trial as if on the command line and check that the output is what we expect. """ def debug(self): pass parent = "_testImportErrors" def runTrial(self, *args): return runTrial("--temp-directory", self.mktemp(), *args) def _print(self, stuff): print(stuff) return stuff def assertIn(self, container, containee, *args, **kwargs): # redefined to be useful in callbacks super().assertIn(containee, container, *args, **kwargs) return container def assertNotIn(self, container, containee, *args, **kwargs): # redefined to be useful in callbacks super().assertNotIn(containee, container, *args, **kwargs) return container def test_trialRun(self): self.runTrial() def test_nonexistentModule(self): d = self.runTrial("twisted.doesntexist") self.assertIn(d, "[ERROR]") self.assertIn(d, "twisted.doesntexist") return d def test_nonexistentPackage(self): d = self.runTrial("doesntexist") self.assertIn(d, "doesntexist") self.assertIn(d, "ModuleNotFound") self.assertIn(d, "[ERROR]") return d def test_nonexistentPackageWithModule(self): d = self.runTrial("doesntexist.barney") self.assertIn(d, "doesntexist.barney") self.assertIn(d, "ObjectNotFound") self.assertIn(d, "[ERROR]") return d def test_badpackage(self): d = self.runTrial("badpackage") self.assertIn(d, "[ERROR]") self.assertIn(d, "badpackage") self.assertNotIn(d, "IOError") return d def test_moduleInBadpackage(self): d = self.runTrial("badpackage.test_module") self.assertIn(d, "[ERROR]") self.assertIn(d, "badpackage.test_module") self.assertNotIn(d, "IOError") return d def test_badmodule(self): d = self.runTrial("package.test_bad_module") self.assertIn(d, "[ERROR]") self.assertIn(d, "package.test_bad_module") self.assertNotIn(d, "IOError") self.assertNotIn(d, "<module ") return d def test_badimport(self): d = self.runTrial("package.test_import_module") self.assertIn(d, "[ERROR]") self.assertIn(d, "package.test_import_module") self.assertNotIn(d, "IOError") self.assertNotIn(d, "<module ") return d def test_recurseImport(self): d = self.runTrial("package") self.assertIn(d, "[ERROR]") self.assertIn(d, "test_bad_module") self.assertIn(d, "test_import_module") self.assertNotIn(d, "<module ") self.assertNotIn(d, "IOError") return d def test_recurseImportErrors(self): d = self.runTrial("package2") self.assertIn(d, "[ERROR]") self.assertIn(d, "package2") self.assertIn(d, "test_module") self.assertIn(d, _noModuleError) self.assertNotIn(d, "<module ") self.assertNotIn(d, "IOError") return d def test_nonRecurseImportErrors(self): d = self.runTrial("-N", "package2") self.assertIn(d, "[ERROR]") self.assertIn(d, _noModuleError) self.assertNotIn(d, "<module ") return d def test_regularRun(self): d = self.runTrial("package.test_module") self.assertNotIn(d, "[ERROR]") self.assertNotIn(d, "IOError") self.assertIn(d, "OK") self.assertIn(d, "PASSED (successes=1)") return d def test_filename(self): self.mangleSysPath(self.oldPath) d = self.runTrial(os.path.join(self.parent, "package", "test_module.py")) self.assertNotIn(d, "[ERROR]") self.assertNotIn(d, "IOError") self.assertIn(d, "OK") self.assertIn(d, "PASSED (successes=1)") return d def test_dosFile(self): ## XXX -- not really an output test, more of a script test self.mangleSysPath(self.oldPath) d = self.runTrial(os.path.join(self.parent, "package", "test_dos_module.py")) self.assertNotIn(d, "[ERROR]") self.assertNotIn(d, "IOError") self.assertIn(d, "OK") self.assertIn(d, "PASSED (successes=1)") return d
Save
cmd:
run