Skip to content

Commit

Permalink
Switch some uses of old command line syntax to new
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed May 19, 2014
1 parent a189b3b commit ae924ec
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 34 deletions.
4 changes: 2 additions & 2 deletions tests/farm/annotate/annotate_dir.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
copy("src", "run")
run("""
coverage -e -x multi.py
coverage -a -d out_anno_dir
coverage run multi.py
coverage annotate -d out_anno_dir
""", rundir="run")
compare("run/out_anno_dir", "gold_anno_dir", "*,cover", left_extra=True)
clean("run")
4 changes: 2 additions & 2 deletions tests/farm/annotate/run.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
copy("src", "out")
run("""
coverage -e -x white.py
coverage -a white.py
coverage run white.py
coverage annotate white.py
""", rundir="out")
compare("out", "gold", "*,cover")
clean("out")
4 changes: 2 additions & 2 deletions tests/farm/annotate/run_multi.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
copy("src", "out_multi")
run("""
coverage -e -x multi.py
coverage -a
coverage run multi.py
coverage annotate
""", rundir="out_multi")
compare("out_multi", "gold_multi", "*,cover")
clean("out_multi")
2 changes: 1 addition & 1 deletion tests/farm/run/run_chdir.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
copy("src", "out")
run("""
coverage run chdir.py
coverage -r
coverage report
""", rundir="out", outfile="stdout.txt")
contains("out/stdout.txt",
"Line One",
Expand Down
8 changes: 4 additions & 4 deletions tests/farm/run/run_timid.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
copy("src", "out")
run("""
python showtrace.py none
coverage -e -x showtrace.py regular
coverage -e -x --timid showtrace.py timid
coverage run showtrace.py regular
coverage run --timid showtrace.py timid
""", rundir="out", outfile="showtraceout.txt")

# When running without coverage, no trace function
Expand All @@ -42,8 +42,8 @@
os.environ['COVERAGE_OPTIONS'] = '--timid'

run("""
coverage -e -x showtrace.py regular
coverage -e -x --timid showtrace.py timid
coverage run showtrace.py regular
coverage run --timid showtrace.py timid
""", rundir="out", outfile="showtraceout.txt")

contains("out/showtraceout.txt",
Expand Down
4 changes: 2 additions & 2 deletions tests/farm/run/run_xxx.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
copy("src", "out")
run("""
coverage -e -x xxx
coverage -r
coverage run xxx
coverage report
""", rundir="out", outfile="stdout.txt")
contains("out/stdout.txt",
"xxx: 3 4 0 7",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_farm.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class FarmTestCase(object):
copy("src", "out")
run('''
coverage -x white.py
coverage -a white.py
coverage run white.py
coverage annotate white.py
''', rundir="out")
compare("out", "gold", "*,cover")
clean("out")
Expand Down
20 changes: 10 additions & 10 deletions tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_save_on_exit(self):
""")

self.assert_doesnt_exist(".coverage")
self.run_command("coverage -x mycode.py")
self.run_command("coverage run mycode.py")
self.assert_exists(".coverage")

def test_environment(self):
Expand All @@ -39,7 +39,7 @@ def test_environment(self):
""")

self.assert_doesnt_exist(".coverage")
out = self.run_command("coverage -x mycode.py")
out = self.run_command("coverage run mycode.py")
self.assert_exists(".coverage")
self.assertEqual(out, 'done\n')

Expand All @@ -55,19 +55,19 @@ def test_combine_parallel_data(self):
print('done')
""")

out = self.run_command("coverage -x -p b_or_c.py b")
out = self.run_command("coverage run -p b_or_c.py b")
self.assertEqual(out, 'done\n')
self.assert_doesnt_exist(".coverage")

out = self.run_command("coverage -x -p b_or_c.py c")
out = self.run_command("coverage run -p b_or_c.py c")
self.assertEqual(out, 'done\n')
self.assert_doesnt_exist(".coverage")

# After two -p runs, there should be two .coverage.machine.123 files.
self.assertEqual(self.number_of_data_files(), 2)

# Combine the parallel coverage data files into .coverage .
self.run_command("coverage -c")
self.run_command("coverage combine")
self.assert_exists(".coverage")

# After combining, there should be only the .coverage file.
Expand All @@ -91,23 +91,23 @@ def test_combine_parallel_data_in_two_steps(self):
print('done')
""")

out = self.run_command("coverage -x -p b_or_c.py b")
out = self.run_command("coverage run -p b_or_c.py b")
self.assertEqual(out, 'done\n')
self.assert_doesnt_exist(".coverage")
self.assertEqual(self.number_of_data_files(), 1)

# Combine the (one) parallel coverage data file into .coverage .
self.run_command("coverage -c")
self.run_command("coverage combine")
self.assert_exists(".coverage")
self.assertEqual(self.number_of_data_files(), 1)

out = self.run_command("coverage -x -p b_or_c.py c")
out = self.run_command("coverage run --append -p b_or_c.py c")
self.assertEqual(out, 'done\n')
self.assert_exists(".coverage")
self.assertEqual(self.number_of_data_files(), 2)

# Combine the parallel coverage data files into .coverage .
self.run_command("coverage -c")
self.run_command("coverage combine")
self.assert_exists(".coverage")

# After combining, there should be only the .coverage file.
Expand Down Expand Up @@ -378,7 +378,7 @@ def main():
self.assertEqual(self.number_of_data_files(), 2)

# Combine the parallel coverage data files into .coverage .
self.run_command("coverage -c")
self.run_command("coverage combine")
self.assert_exists(".coverage")

# After combining, there should be only the .coverage file.
Expand Down
18 changes: 9 additions & 9 deletions tests/test_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ def last_line_squeezed(self, report):
return re.sub(r"\s+", " ", last_line)

def test_report(self):
out = self.run_command("coverage -x mycode.py")
out = self.run_command("coverage run mycode.py")
self.assertEqual(out, 'done\n')
report = self.report_from_command("coverage -r")
report = self.report_from_command("coverage report")

# Name Stmts Miss Cover
# ---------------------------------------------------------------------
Expand All @@ -58,8 +58,8 @@ def test_report(self):

def test_report_just_one(self):
# Try reporting just one module
self.run_command("coverage -x mycode.py")
report = self.report_from_command("coverage -r mycode.py")
self.run_command("coverage run mycode.py")
report = self.report_from_command("coverage report mycode.py")

# Name Stmts Miss Cover
# ----------------------------
Expand Down Expand Up @@ -91,8 +91,8 @@ def test_report_wildcard(self):
def test_report_omitting(self):
# Try reporting while omitting some modules
prefix = os.path.split(__file__)[0]
self.run_command("coverage -x mycode.py")
report = self.report_from_command("coverage -r -o '%s/*'" % prefix)
self.run_command("coverage run mycode.py")
report = self.report_from_command("coverage report --omit '%s/*'" % prefix)

# Name Stmts Miss Cover
# ----------------------------
Expand Down Expand Up @@ -148,7 +148,7 @@ def test_dotpy_not_python(self):

self.run_command("coverage run mycode.py")
self.make_file("mycode.py", "This isn't python at all!")
report = self.report_from_command("coverage -r mycode.py")
report = self.report_from_command("coverage report mycode.py")

# pylint: disable=C0301
# Name Stmts Miss Cover
Expand All @@ -171,7 +171,7 @@ def test_dotpy_not_python_ignored(self):
# but we've said to ignore errors, so there's no error reported.
self.run_command("coverage run mycode.py")
self.make_file("mycode.py", "This isn't python at all!")
report = self.report_from_command("coverage -r -i mycode.py")
report = self.report_from_command("coverage report -i mycode.py")

# Name Stmts Miss Cover
# ----------------------------
Expand All @@ -187,7 +187,7 @@ def test_dothtml_not_python(self):
self.run_command("coverage run mycode.html")
# Before reporting, change it to be an HTML file.
self.make_file("mycode.html", "<h1>This isn't python at all!</h1>")
report = self.report_from_command("coverage -r mycode.html")
report = self.report_from_command("coverage report mycode.html")

# Name Stmts Miss Cover
# ----------------------------
Expand Down

0 comments on commit ae924ec

Please sign in to comment.