diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2010-06-18 21:08:11 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2010-06-18 21:08:11 -0400 |
commit | 9f323147ddf875ce158bd3f1792b69c4004b7caa (patch) | |
tree | 9aad289eb129d6f21718cdd10e3598a6c6e894a7 | |
parent | 2d939aec11b6d75b336c3e39cd53e221b40d854b (diff) | |
download | python-coveragepy-git-9f323147ddf875ce158bd3f1792b69c4004b7caa.tar.gz |
All tests now use underscore names instead of some having camelCase names.
-rw-r--r-- | test/test_api.py | 35 | ||||
-rw-r--r-- | test/test_cmdline.py | 64 | ||||
-rw-r--r-- | test/test_coverage.py | 138 | ||||
-rw-r--r-- | test/test_oddball.py | 12 | ||||
-rw-r--r-- | test/test_process.py | 6 |
5 files changed, 128 insertions, 127 deletions
diff --git a/test/test_api.py b/test/test_api.py index 60d248e9..264d7131 100644 --- a/test/test_api.py +++ b/test/test_api.py @@ -18,7 +18,7 @@ class SingletonApiTest(CoverageTest): # writing .coverage files at exit. coverage.use_cache(0) - def doReportWork(self, modname): + def do_report_work(self, modname): """Create a module named `modname`, then measure it.""" coverage.erase() @@ -37,7 +37,7 @@ class SingletonApiTest(CoverageTest): self.import_module(modname) # pragma: recursive coverage coverage.stop() # pragma: recursive coverage - def testSimple(self): + def test_simple(self): coverage.erase() self.make_file("mycode.py", """\ @@ -58,8 +58,8 @@ class SingletonApiTest(CoverageTest): self.assertEqual(missing, [4]) self.assertEqual(missingtext, "4") - def testReport(self): - self.doReportWork("mycode2") + def test_report(self): + self.do_report_work("mycode2") coverage.report(["mycode2.py"]) self.assertEqual(self.stdout(), textwrap.dedent("""\ Name Stmts Miss Cover Missing @@ -67,9 +67,9 @@ class SingletonApiTest(CoverageTest): mycode2 7 3 57% 4-6 """)) - def testReportFile(self): + def test_report_file(self): # The file= argument of coverage.report makes the report go there. - self.doReportWork("mycode3") + self.do_report_work("mycode3") fout = StringIO() coverage.report(["mycode3.py"], file=fout) self.assertEqual(self.stdout(), "") @@ -79,9 +79,9 @@ class SingletonApiTest(CoverageTest): mycode3 7 3 57% 4-6 """)) - def testReportDefault(self): + def test_report_default(self): # Calling report() with no morfs will report on whatever was executed. - self.doReportWork("mycode4") + self.do_report_work("mycode4") coverage.report() rpt = re.sub(r"\s+", " ", self.stdout()) self.assertTrue("mycode4 7 3 57% 4-6" in rpt) @@ -90,7 +90,7 @@ class SingletonApiTest(CoverageTest): class ApiTest(CoverageTest): """Api-oriented tests for Coverage.""" - def testUnexecutedFile(self): + def test_unexecuted_file(self): cov = coverage.coverage() self.make_file("mycode.py", """\ @@ -114,7 +114,7 @@ class ApiTest(CoverageTest): self.assertEqual(statements, [1]) self.assertEqual(missing, [1]) - def testFileNames(self): + def test_filenames(self): self.make_file("mymain.py", """\ import mymod @@ -158,7 +158,7 @@ class ApiTest(CoverageTest): filename, _, _, _ = cov.analysis(sys.modules["mymod"]) self.assertEqual(os.path.basename(filename), "mymod.py") - def testIgnoreStdLib(self): + def test_ignore_stdlib(self): self.make_file("mymain.py", """\ import mymod, colorsys a = 1 @@ -196,7 +196,7 @@ class ApiTest(CoverageTest): _, statements, missing, _ = cov2.analysis("colorsys.py") self.assertNotEqual(statements, missing) - def testExcludeList(self): + def test_exclude_list(self): cov = coverage.coverage() cov.clear_exclude() self.assertEqual(cov.get_exclude_list(), []) @@ -208,7 +208,7 @@ class ApiTest(CoverageTest): cov.clear_exclude() self.assertEqual(cov.get_exclude_list(), []) - def testDatafileDefault(self): + def test_datafile_default(self): # Default data file behavior: it's .coverage self.make_file("datatest1.py", """\ fooey = 17 @@ -223,7 +223,7 @@ class ApiTest(CoverageTest): self.assertSameElements(os.listdir("."), ["datatest1.py", "datatest1.pyc", ".coverage"]) - def testDatafileSpecified(self): + def test_datafile_specified(self): # You can specify the data file name. self.make_file("datatest2.py", """\ fooey = 17 @@ -238,7 +238,7 @@ class ApiTest(CoverageTest): self.assertSameElements(os.listdir("."), ["datatest2.py", "datatest2.pyc", "cov.data"]) - def testDatafileAndSuffixSpecified(self): + def test_datafile_and_suffix_specified(self): # You can specify the data file name and suffix. self.make_file("datatest3.py", """\ fooey = 17 @@ -253,7 +253,7 @@ class ApiTest(CoverageTest): self.assertSameElements(os.listdir("."), ["datatest3.py", "datatest3.pyc", "cov.data.14"]) - def testDatafileFromRcFile(self): + def test_datafile_from_rcfile(self): # You can specify the data file name in the .coveragerc file self.make_file("datatest4.py", """\ fooey = 17 @@ -273,12 +273,13 @@ class ApiTest(CoverageTest): self.assertSameElements(os.listdir("."), ["datatest4.py", "datatest4.pyc", ".coveragerc", "mydata.dat"]) - def testEmptyReporting(self): + def test_empty_reporting(self): # Used to be you'd get an exception reporting on nothing... cov = coverage.coverage() cov.erase() cov.report() + class OmitIncludeTest(CoverageTest): """Test using `omit` and `include` when measuring code.""" diff --git a/test/test_cmdline.py b/test/test_cmdline.py index 515d86ce..00a0bfdf 100644 --- a/test/test_cmdline.py +++ b/test/test_cmdline.py @@ -93,7 +93,7 @@ class CmdLineTest(CoverageTest): class ClassicCmdLineTest(CmdLineTest): """Tests of the classic coverage.py command line.""" - def testErase(self): + def test_erase(self): # coverage -e self.cmd_executes("-e", """\ .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, source=None, include=None, omit=None) @@ -101,7 +101,7 @@ class ClassicCmdLineTest(CmdLineTest): """) self.cmd_executes_same("-e", "--erase") - def testExecute(self): + def test_execute(self): # coverage -x [-p] [-L] [--timid] MODULE.py [ARG1 ARG2 ...] # -x calls coverage.load first. @@ -147,7 +147,7 @@ class ClassicCmdLineTest(CmdLineTest): self.cmd_executes_same("-x -p f.py", "-x --parallel-mode f.py") self.cmd_executes_same("-x -L f.py", "-x --pylib f.py") - def testCombine(self): + def test_combine(self): # coverage -c self.cmd_executes("-c", """\ .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, source=None, include=None, omit=None) @@ -157,7 +157,7 @@ class ClassicCmdLineTest(CmdLineTest): """) self.cmd_executes_same("-c", "--combine") - def testReport(self): + def test_report(self): # coverage -r [-m] [-i] [-o DIR,...] [FILE1 FILE2 ...] self.cmd_executes("-r", self.INIT_LOAD + """\ .report(ignore_errors=None, omit=None, include=None, morfs=[], @@ -202,7 +202,7 @@ class ClassicCmdLineTest(CmdLineTest): self.cmd_executes_same("-r -of", "-r --omit=f") self.cmd_executes_same("-r -of,b", "-r --omit=f,b") - def testAnnotate(self): + def test_annotate(self): # coverage -a [-d DIR] [-i] [-o DIR,...] [FILE1 FILE2 ...] self.cmd_executes("-a", self.INIT_LOAD + """\ .annotate(directory=None, ignore_errors=None, @@ -247,7 +247,7 @@ class ClassicCmdLineTest(CmdLineTest): self.cmd_executes_same("-a -of", "-a --omit=f") self.cmd_executes_same("-a -of,b", "-a --omit=f,b") - def testHtmlReport(self): + def test_html_report(self): # coverage -b -d DIR [-i] [-o DIR,...] [FILE1 FILE2 ...] self.cmd_executes("-b", self.INIT_LOAD + """\ .html_report(directory=None, ignore_errors=None, @@ -290,26 +290,26 @@ class ClassicCmdLineTest(CmdLineTest): self.cmd_executes_same("-b -of", "-b --omit=f") self.cmd_executes_same("-b -of,b", "-b --omit=f,b") - def testHelp(self): + def test_help(self): # coverage -h self.cmd_help("-h", topic="help", ret=OK) self.cmd_help("--help", topic="help", ret=OK) - def testVersion(self): + def test_version(self): # coverage --version self.cmd_help("--version", topic="version", ret=OK) ## Error cases - def testArglessActions(self): + def test_argless_actions(self): self.cmd_help("-e foo bar", "Unexpected arguments: foo bar") self.cmd_help("-c baz quux", "Unexpected arguments: baz quux") - def testNeedAction(self): + def test_need_action(self): self.cmd_help("-p", "You must specify at least one of " "-e, -x, -c, -r, -a, or -b.") - def testBadActionCombinations(self): + def test_bad_action_combinations(self): self.cmd_help('-e -a', "You can't specify the 'erase' and 'annotate' " "options at the same time." @@ -343,10 +343,10 @@ class ClassicCmdLineTest(CmdLineTest): "options at the same time." ) - def testNothingToDo(self): + def test_nothing_to_do(self): self.cmd_help("-x", "Nothing to do.") - def testUnknownOption(self): + def test_unknown_option(self): self.cmd_help("-z", "no such option: -z") @@ -380,7 +380,7 @@ class FakeCoverageForDebugData(object): class NewCmdLineTest(CmdLineTest): """Tests of the coverage.py command line.""" - def testAnnotate(self): + def test_annotate(self): self.cmd_executes_same("annotate", "-a") self.cmd_executes_same("annotate -i", "-a -i") self.cmd_executes_same("annotate -d d1", "-a -d d1") @@ -389,14 +389,14 @@ class NewCmdLineTest(CmdLineTest): self.cmd_executes_same("annotate m1", "-a m1") self.cmd_executes_same("annotate m1 m2 m3", "-a m1 m2 m3") - def testCombine(self): + def test_combine(self): self.cmd_executes_same("combine", "-c") - def testDebug(self): + def test_debug(self): self.cmd_help("debug", "What information would you like: data, sys?") self.cmd_help("debug foo", "Don't know what you mean by 'foo'") - def testDebugData(self): + def test_debug_data(self): fake = FakeCoverageForDebugData({ 'file1.py': 17, 'file2.py': 23, }) @@ -411,7 +411,7 @@ class NewCmdLineTest(CmdLineTest): file2.py: 23 lines """)) - def testDebugDataWithNoData(self): + def test_debug_data_with_no_data(self): fake = FakeCoverageForDebugData({}) self.command_line("debug data", _covpkg=fake) self.assertMultiLineEqual(self.stdout(), textwrap.dedent("""\ @@ -421,24 +421,24 @@ class NewCmdLineTest(CmdLineTest): No data collected """)) - def testDebugSys(self): + def test_debug_sys(self): self.command_line("debug sys") out = self.stdout() assert "version:" in out assert "data_path:" in out - def testErase(self): + def test_erase(self): self.cmd_executes_same("erase", "-e") - def testHelp(self): + def test_help(self): self.cmd_executes("help", ".help_fn(topic='help')") - def testCmdHelp(self): + def test_cmd_help(self): self.cmd_executes("run --help", ".help_fn(parser='<CmdOptionParser:run>')") self.cmd_executes_same("help run", "run --help") - def testHtml(self): + def test_html(self): self.cmd_executes_same("html", "-b") self.cmd_executes_same("html -i", "-b -i") self.cmd_executes_same("html -d d1", "-b -d d1") @@ -447,7 +447,7 @@ class NewCmdLineTest(CmdLineTest): self.cmd_executes_same("html m1", "-b m1") self.cmd_executes_same("html m1 m2 m3", "-b m1 m2 m3") - def testReport(self): + def test_report(self): self.cmd_executes_same("report", "-r") self.cmd_executes_same("report -i", "-r -i") self.cmd_executes_same("report -m", "-r -m") @@ -456,7 +456,7 @@ class NewCmdLineTest(CmdLineTest): self.cmd_executes_same("report m1", "-r m1") self.cmd_executes_same("report m1 m2 m3", "-r m1 m2 m3") - def testRun(self): + def test_run(self): self.cmd_executes_same("run f.py", "-e -x f.py") self.cmd_executes_same("run f.py -a arg -z", "-e -x f.py -a arg -z") self.cmd_executes_same("run -a f.py", "-x f.py") @@ -520,7 +520,7 @@ class NewCmdLineTest(CmdLineTest): .save() """) - def testXml(self): + def test_xml(self): # coverage xml [-i] [--omit DIR,...] [FILE1 FILE2 ...] self.cmd_executes("xml", self.INIT_LOAD + """\ .xml_report(ignore_errors=None, omit=None, include=None, morfs=[], @@ -559,36 +559,36 @@ class NewCmdLineTest(CmdLineTest): morfs=["mod1", "mod2", "mod3"], outfile="coverage.xml") """) - def testNoArgumentsAtAll(self): + def test_no_arguments_at_all(self): self.cmd_help("", topic="minimum_help", ret=OK) - def testBadCommand(self): + def test_bad_command(self): self.cmd_help("xyzzy", "Unknown command: 'xyzzy'") class CmdLineStdoutTest(CmdLineTest): """Test the command line with real stdout output.""" - def testMinimumHelp(self): + def test_minimum_help(self): self.command_line("") out = self.stdout() assert "Code coverage for Python." in out assert out.count("\n") < 4 - def testHelp(self): + def test_help(self): self.command_line("help") out = self.stdout() assert "nedbatchelder.com" in out assert out.count("\n") > 10 - def testCmdHelp(self): + def test_cmd_help(self): self.command_line("help run") out = self.stdout() assert "<pyfile>" in out assert "--timid" in out assert out.count("\n") > 10 - def testError(self): + def test_error(self): self.command_line("fooey kablooey", ret=ERR) out = self.stdout() assert "fooey" in out diff --git a/test/test_coverage.py b/test/test_coverage.py index a9a478a9..4fd54494 100644 --- a/test/test_coverage.py +++ b/test/test_coverage.py @@ -93,7 +93,7 @@ class TestCoverageTest(CoverageTest): class BasicCoverageTest(CoverageTest): """The simplest tests, for quick smoke testing of fundamental changes.""" - def testSimple(self): + def test_simple(self): self.check_coverage("""\ a = 1 b = 2 @@ -104,7 +104,7 @@ class BasicCoverageTest(CoverageTest): """, [1,2,4,6], report="4 0 100%") - def testIndentationWackiness(self): + def test_indentation_wackiness(self): # Partial final lines are OK. self.check_coverage("""\ import sys @@ -113,7 +113,7 @@ class BasicCoverageTest(CoverageTest): """, [1,2,3], "3") - def testMultilineInitializer(self): + def test_multiline_initializer(self): self.check_coverage("""\ d = { 'foo': 1+2, @@ -125,7 +125,7 @@ class BasicCoverageTest(CoverageTest): """, [1,7], "") - def testListComprehension(self): + def test_list_comprehension(self): self.check_coverage("""\ l = [ 2*i for i in range(10) @@ -139,7 +139,7 @@ class BasicCoverageTest(CoverageTest): class SimpleStatementTest(CoverageTest): """Testing simple single-line statements.""" - def testExpression(self): + def test_expression(self): self.check_coverage("""\ 1 + 2 1 + \\ @@ -147,7 +147,7 @@ class SimpleStatementTest(CoverageTest): """, [1,2], "") - def testAssert(self): + def test_assert(self): self.check_coverage("""\ assert (1 + 2) assert (1 + @@ -159,7 +159,7 @@ class SimpleStatementTest(CoverageTest): """, [1,2,4,5], "") - def testAssignment(self): + def test_assignment(self): # Simple variable assignment self.check_coverage("""\ a = (1 + 2) @@ -170,7 +170,7 @@ class SimpleStatementTest(CoverageTest): """, [1,2,4], "") - def testAssignTuple(self): + def test_assign_tuple(self): self.check_coverage("""\ a = 1 a,b,c = 7,8,9 @@ -178,7 +178,7 @@ class SimpleStatementTest(CoverageTest): """, [1,2,3], "") - def testAttributeAssignment(self): + def test_attribute_assignment(self): # Attribute assignment self.check_coverage("""\ class obj: pass @@ -191,7 +191,7 @@ class SimpleStatementTest(CoverageTest): """, [1,2,3,4,6], "") - def testListofAttributeAssignment(self): + def test_list_of_attribute_assignment(self): self.check_coverage("""\ class obj: pass o = obj() @@ -205,7 +205,7 @@ class SimpleStatementTest(CoverageTest): """, [1,2,3,4,7], "") - def testAugmentedAssignment(self): + def test_augmented_assignment(self): self.check_coverage("""\ a = 1 a += 1 @@ -216,7 +216,7 @@ class SimpleStatementTest(CoverageTest): """, [1,2,3,5], "") - def testTripleStringStuff(self): + def test_triple_string_stuff(self): self.check_coverage("""\ a = ''' a multiline @@ -238,7 +238,7 @@ class SimpleStatementTest(CoverageTest): """, [1,5,11], "") - def testPass(self): + def test_pass(self): # pass is tricky: if it's the only statement in a block, then it is # "executed". But if it is not the only statement, then it is not. self.check_coverage("""\ @@ -275,7 +275,7 @@ class SimpleStatementTest(CoverageTest): """, ([1,2,4,5], [1,2,5]), "") - def testDel(self): + def test_del(self): self.check_coverage("""\ d = { 'a': 1, 'b': 1, 'c': 1, 'd': 1, 'e': 1 } del d['a'] @@ -290,7 +290,7 @@ class SimpleStatementTest(CoverageTest): [1,2,3,6,9], "") if sys.version_info < (3, 0): # Print statement is gone in Py3k. - def testPrint(self): + def test_print(self): self.check_coverage("""\ print "hello, world!" print ("hey: %d" % @@ -303,7 +303,7 @@ class SimpleStatementTest(CoverageTest): """, [1,2,4,5,6,8], "") - def testRaise(self): + def test_raise(self): self.check_coverage("""\ try: raise Exception( @@ -314,7 +314,7 @@ class SimpleStatementTest(CoverageTest): """, [1,2,5,6], "") - def testReturn(self): + def test_return(self): self.check_coverage("""\ def fn(): a = 1 @@ -347,7 +347,7 @@ class SimpleStatementTest(CoverageTest): """, [1,2,3,7,8], "") - def testYield(self): + def test_yield(self): self.check_coverage("""\ from __future__ import generators def gen(): @@ -362,7 +362,7 @@ class SimpleStatementTest(CoverageTest): """, [1,2,3,4,7,9,10], "") - def testBreak(self): + def test_break(self): self.check_coverage("""\ for x in range(10): a = 2 + x @@ -372,7 +372,7 @@ class SimpleStatementTest(CoverageTest): """, [1,2,3,4,5], "4") - def testContinue(self): + def test_continue(self): self.check_coverage("""\ for x in range(10): a = 2 + x @@ -386,7 +386,7 @@ class SimpleStatementTest(CoverageTest): # Peephole optimization of jumps to jumps can mean that some statements # never hit the line tracer. The behavior is different in different # versions of Python, so don't run this test: - def testStrangeUnexecutedContinue(self): + def test_strange_unexecuted_continue(self): self.check_coverage("""\ a = b = c = 0 for n in range(100): @@ -412,7 +412,7 @@ class SimpleStatementTest(CoverageTest): """, [1,2,3,4,5,6,8,9,10, 12,13,14,15,16,17,19,20,21], "") - def testImport(self): + def test_import(self): self.check_coverage("""\ import string from sys import path @@ -459,7 +459,7 @@ class SimpleStatementTest(CoverageTest): """, [1,3], "") - def testGlobal(self): + def test_global(self): self.check_coverage("""\ g = h = i = 1 def fn(): @@ -482,7 +482,7 @@ class SimpleStatementTest(CoverageTest): if sys.version_info < (3, 0): # In Python 2.x, exec is a statement. - def testExec(self): + def test_exec(self): self.check_coverage("""\ a = b = c = 1 exec "a = 2" @@ -513,7 +513,7 @@ class SimpleStatementTest(CoverageTest): [1,2,3,4,7], "") else: # In Python 3.x, exec is a function. - def testExec(self): + def test_exec(self): self.check_coverage("""\ a = b = c = 1 exec("a = 2") @@ -543,7 +543,7 @@ class SimpleStatementTest(CoverageTest): """, [1,2,3,4,7], "") - def testExtraDocString(self): + def test_extra_doc_string(self): self.check_coverage("""\ a = 1 "An extra docstring, should be a comment." @@ -566,7 +566,7 @@ class SimpleStatementTest(CoverageTest): class CompoundStatementTest(CoverageTest): """Testing coverage of multi-line compound statements.""" - def testStatementList(self): + def test_statement_list(self): self.check_coverage("""\ a = 1; b = 2; c = 3 @@ -576,7 +576,7 @@ class CompoundStatementTest(CoverageTest): """, [1,2,3,5], "") - def testIf(self): + def test_if(self): self.check_coverage("""\ a = 1 if a == 1: @@ -619,7 +619,7 @@ class CompoundStatementTest(CoverageTest): """, [1,2,3,4,6,8,9], "6-8") - def testElif(self): + def test_elif(self): self.check_coverage("""\ a = 1; b = 2; c = 3; if a == 1: @@ -654,7 +654,7 @@ class CompoundStatementTest(CoverageTest): """, [1,2,3,4,5,7,8], "3, 5", report="7 2 71% 3, 5") - def testElifNoElse(self): + def test_elif_no_else(self): self.check_coverage("""\ a = 1; b = 2; c = 3; if a == 1: @@ -674,7 +674,7 @@ class CompoundStatementTest(CoverageTest): """, [1,2,3,4,5,6], "3", report="6 1 83% 3") - def testElifBizarre(self): + def test_elif_bizarre(self): self.check_coverage("""\ def f(self): if self==1: @@ -692,7 +692,7 @@ class CompoundStatementTest(CoverageTest): """, [1,2,3,4,5,6,7,8,9,10,11,13], "2-13") - def testSplitIf(self): + def test_split_if(self): self.check_coverage("""\ a = 1; b = 2; c = 3; if \\ @@ -733,7 +733,7 @@ class CompoundStatementTest(CoverageTest): """, [1,2,4,5,7,9,10], "4, 7") - def testPathologicalSplitIf(self): + def test_pathological_split_if(self): self.check_coverage("""\ a = 1; b = 2; c = 3; if ( @@ -780,7 +780,7 @@ class CompoundStatementTest(CoverageTest): """, [1,2,5,6,9,11,12], "5, 9") - def testAbsurdSplitIf(self): + def test_absurd_split_if(self): self.check_coverage("""\ a = 1; b = 2; c = 3; if a == 1 \\ @@ -821,7 +821,7 @@ class CompoundStatementTest(CoverageTest): """, [1,2,4,5,7,9,10], "4, 7") - def testWhile(self): + def test_while(self): self.check_coverage("""\ a = 3; b = 0 while a: @@ -840,7 +840,7 @@ class CompoundStatementTest(CoverageTest): """, [1,2,3,4,5,6], "5") - def testWhileElse(self): + def test_while_else(self): # Take the else branch. self.check_coverage("""\ a = 3; b = 0 @@ -866,7 +866,7 @@ class CompoundStatementTest(CoverageTest): """, [1,2,3,4,5,6,8,9], "6-8") - def testSplitWhile(self): + def test_split_while(self): self.check_coverage("""\ a = 3; b = 0 while \\ @@ -887,7 +887,7 @@ class CompoundStatementTest(CoverageTest): """, [1,2,5,6,7], "") - def testFor(self): + def test_for(self): self.check_coverage("""\ a = 0 for i in [1,2,3,4,5]: @@ -914,7 +914,7 @@ class CompoundStatementTest(CoverageTest): """, [1,2,3,4,5,6], "5") - def testForElse(self): + def test_for_else(self): self.check_coverage("""\ a = 0 for i in range(5): @@ -936,7 +936,7 @@ class CompoundStatementTest(CoverageTest): """, [1,2,3,4,5,7,8], "5-7") - def testSplitFor(self): + def test_split_for(self): self.check_coverage("""\ a = 0 for \\ @@ -956,7 +956,7 @@ class CompoundStatementTest(CoverageTest): """, [1,2,6,7], "") - def testTryExcept(self): + def test_try_except(self): self.check_coverage("""\ a = 0 try: @@ -1026,7 +1026,7 @@ class CompoundStatementTest(CoverageTest): """, [1,2,3,4,5,6,8,9], "8") - def testTryFinally(self): + def test_try_finally(self): self.check_coverage("""\ a = 0 try: @@ -1050,7 +1050,7 @@ class CompoundStatementTest(CoverageTest): """, [1,2,3,4,5,7,8,9,10], "") - def testFunctionDef(self): + def test_function_def(self): self.check_coverage("""\ a = 99 def foo(): @@ -1092,7 +1092,7 @@ class CompoundStatementTest(CoverageTest): """, [1,10,12,13], "") - def testClassDef(self): + def test_class_def(self): self.check_coverage("""\ # A comment. class theClass: @@ -1115,7 +1115,7 @@ class CompoundStatementTest(CoverageTest): class ExcludeTest(CoverageTest): """Tests of the exclusion feature to mark lines as not covered.""" - def testDefault(self): + def test_default(self): # A number of forms of pragma comment are accepted. self.check_coverage("""\ a = 1 @@ -1127,7 +1127,7 @@ class ExcludeTest(CoverageTest): [1,3,5] ) - def testSimple(self): + def test_simple(self): self.check_coverage("""\ a = 1; b = 2 @@ -1136,7 +1136,7 @@ class ExcludeTest(CoverageTest): """, [1,3], "", ['-cc']) - def testTwoExcludes(self): + def test_two_excludes(self): self.check_coverage("""\ a = 1; b = 2 @@ -1148,7 +1148,7 @@ class ExcludeTest(CoverageTest): """, [1,3,5,7], "5", ['-cc', '-xx']) - def testExcludingIfSuite(self): + def test_excluding_if_suite(self): self.check_coverage("""\ a = 1; b = 2 @@ -1160,7 +1160,7 @@ class ExcludeTest(CoverageTest): """, [1,7], "", ['if 0:']) - def testExcludingIfButNotElseSuite(self): + def test_excluding_if_but_not_else_suite(self): self.check_coverage("""\ a = 1; b = 2 @@ -1175,7 +1175,7 @@ class ExcludeTest(CoverageTest): """, [1,8,9,10], "", ['if 0:']) - def testExcludingElseSuite(self): + def test_excluding_else_suite(self): self.check_coverage("""\ a = 1; b = 2 @@ -1210,7 +1210,7 @@ class ExcludeTest(CoverageTest): """, [1,3,4,5,6,17], "", ['#pragma: NO COVER']) - def testExcludingElifSuites(self): + def test_excluding_elif_suites(self): self.check_coverage("""\ a = 1; b = 2 @@ -1228,7 +1228,7 @@ class ExcludeTest(CoverageTest): """, [1,3,4,5,6,11,12,13], "11-12", ['#pragma: NO COVER']) - def testExcludingOnelineIf(self): + def test_excluding_oneline_if(self): self.check_coverage("""\ def foo(): a = 2 @@ -1239,7 +1239,7 @@ class ExcludeTest(CoverageTest): """, [1,2,4,6], "", ["no cover"]) - def testExcludingAColonNotASuite(self): + def test_excluding_a_colon_not_a_suite(self): self.check_coverage("""\ def foo(): l = list(range(10)) @@ -1250,7 +1250,7 @@ class ExcludeTest(CoverageTest): """, [1,2,4,6], "", ["no cover"]) - def testExcludingForSuite(self): + def test_excluding_for_suite(self): self.check_coverage("""\ a = 0 for i in [1,2,3,4,5]: #pragma: NO COVER @@ -1278,7 +1278,7 @@ class ExcludeTest(CoverageTest): """, [1,7], "", ['#pragma: NO COVER']) - def testExcludingForElse(self): + def test_excluding_for_else(self): self.check_coverage("""\ a = 0 for i in range(5): @@ -1291,7 +1291,7 @@ class ExcludeTest(CoverageTest): """, [1,2,3,4,5,8], "5", ['#pragma: NO COVER']) - def testExcludingWhile(self): + def test_excluding_while(self): self.check_coverage("""\ a = 3; b = 0 while a*b: #pragma: NO COVER @@ -1313,7 +1313,7 @@ class ExcludeTest(CoverageTest): """, [1,8], "", ['#pragma: NO COVER']) - def testExcludingWhileElse(self): + def test_excluding_while_else(self): self.check_coverage("""\ a = 3; b = 0 while a: @@ -1326,7 +1326,7 @@ class ExcludeTest(CoverageTest): """, [1,2,3,4,5,8], "5", ['#pragma: NO COVER']) - def testExcludingTryExcept(self): + def test_excluding_try_except(self): self.check_coverage("""\ a = 0 try: @@ -1382,7 +1382,7 @@ class ExcludeTest(CoverageTest): """, [1,2,3,4,5,6,9], "", ['#pragma: NO COVER']) - def testExcludingTryExceptPass(self): + def test_excluding_try_except_pass(self): self.check_coverage("""\ a = 0 try: @@ -1428,7 +1428,7 @@ class ExcludeTest(CoverageTest): """, [1,2,3,4,5,6,9], "", ['#pragma: NO COVER']) - def testExcludingIfPass(self): + def test_excluding_if_pass(self): # From a comment on the coverage page by Michael McNeil Forbes: self.check_coverage("""\ def f(): @@ -1441,7 +1441,7 @@ class ExcludeTest(CoverageTest): """, [1,7], "", ["no cover"]) - def testExcludingFunction(self): + def test_excluding_function(self): self.check_coverage("""\ def fn(foo): #pragma: NO COVER a = 1 @@ -1453,7 +1453,7 @@ class ExcludeTest(CoverageTest): """, [6,7], "", ['#pragma: NO COVER']) - def testExcludingMethod(self): + def test_excluding_method(self): self.check_coverage("""\ class Fooey: def __init__(self): @@ -1467,7 +1467,7 @@ class ExcludeTest(CoverageTest): """, [1,2,3,8,9], "", ['#pragma: NO COVER']) - def testExcludingClass(self): + def test_excluding_class(self): self.check_coverage("""\ class Fooey: #pragma: NO COVER def __init__(self): @@ -1486,7 +1486,7 @@ if sys.version_info >= (2, 4): class Py24Test(CoverageTest): """Tests of new syntax in Python 2.4.""" - def testFunctionDecorators(self): + def test_function_decorators(self): self.check_coverage("""\ def require_int(func): def wrapper(arg): @@ -1503,7 +1503,7 @@ if sys.version_info >= (2, 4): """, [1,2,3,4,6,8,10,12], "") - def testFunctionDecoratorsWithArgs(self): + def test_function_decorators_with_args(self): self.check_coverage("""\ def boost_by(extra): def decorator(func): @@ -1520,7 +1520,7 @@ if sys.version_info >= (2, 4): """, [1,2,3,4,5,6,8,10,12], "") - def testDoubleFunctionDecorators(self): + def test_double_function_decorators(self): self.check_coverage("""\ def require_int(func): def wrapper(arg): @@ -1557,7 +1557,7 @@ if sys.version_info >= (2, 5): class Py25Test(CoverageTest): """Tests of new syntax in Python 2.5.""" - def testWithStatement(self): + def test_with_statement(self): self.check_coverage("""\ from __future__ import with_statement @@ -1582,7 +1582,7 @@ if sys.version_info >= (2, 5): """, [1,3,4,5,7,8,10,11,12,13,15,16,17,18,19,20], "") - def testTryExceptFinally(self): + def test_try_except_finally(self): self.check_coverage("""\ a = 0; b = 0 try: @@ -1668,7 +1668,7 @@ if sys.version_info >= (2, 5): class ModuleTest(CoverageTest): """Tests for the module-level behavior of the `coverage` module.""" - def testNotSingleton(self): + def test_not_singleton(self): # You *can* create another coverage object. coverage.coverage() coverage.coverage() diff --git a/test/test_oddball.py b/test/test_oddball.py index 7d8084ae..33b4be9d 100644 --- a/test/test_oddball.py +++ b/test/test_oddball.py @@ -10,7 +10,7 @@ import osinfo class ThreadingTest(CoverageTest): """Tests of the threading support.""" - def testThreading(self): + def test_threading(self): self.check_coverage("""\ import time, threading @@ -34,7 +34,7 @@ class ThreadingTest(CoverageTest): class RecursionTest(CoverageTest): """Check what happens when recursive code gets near limits.""" - def testShortRecursion(self): + def test_short_recursion(self): # We can definitely get close to 500 stack frames. self.check_coverage("""\ def recur(n): @@ -47,7 +47,7 @@ class RecursionTest(CoverageTest): """, [1,2,3,5,7], "") - def testLongRecursion(self): + def test_long_recursion(self): # We can't finish a very deep recursion, but we don't crash. self.assertRaises(RuntimeError, self.check_coverage, """\ @@ -98,7 +98,7 @@ class MemoryLeakTest(CoverageTest): class PyexpatTest(CoverageTest): """Pyexpat screws up tracing. Make sure we've counter-defended properly.""" - def testPyexpat(self): + def test_pyexpat(self): # pyexpat calls the trace function explicitly (inexplicably), and does # it wrong for exceptions. Parsing a DOCTYPE for some reason throws # an exception internally, and triggers its wrong behavior. This test @@ -146,7 +146,7 @@ class ExceptionTest(CoverageTest): in the trace function. """ - def testException(self): + def test_exception(self): # Python 2.3's trace function doesn't get called with "return" if the # scope is exiting due to an exception. This confounds our trace # function which relies on scope announcements to track which files to @@ -261,7 +261,7 @@ if sys.version_info >= (2, 5): # copy without the monkeypatch. del sys.modules['doctest'] - def testDoctest(self): + def test_doctest(self): self.check_coverage('''\ def return_arg_or_void(arg): """If <arg> is None, return "Void"; otherwise return <arg> diff --git a/test/test_process.py b/test/test_process.py index 1f8a9884..d59d0726 100644 --- a/test/test_process.py +++ b/test/test_process.py @@ -18,7 +18,7 @@ class ProcessTest(CoverageTest): num += 1 return num - def testSaveOnExit(self): + def test_save_on_exit(self): self.make_file("mycode.py", """\ h = "Hello" w = "world" @@ -28,7 +28,7 @@ class ProcessTest(CoverageTest): self.run_command("coverage -x mycode.py") self.assertTrue(os.path.exists(".coverage")) - def testEnvironment(self): + def test_environment(self): # Checks that we can import modules from the test directory at all! self.make_file("mycode.py", """\ import covmod1 @@ -42,7 +42,7 @@ class ProcessTest(CoverageTest): self.assertTrue(os.path.exists(".coverage")) self.assertEqual(out, 'done\n') - def testCombineParallelData(self): + def test_combine_parallel_data(self): self.make_file("b_or_c.py", """\ import sys a = 1 |