summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2013-09-28 12:55:23 -0400
committerNed Batchelder <ned@nedbatchelder.com>2013-09-28 12:55:23 -0400
commitb33c041b055f0bc243790d6cce4bb32689f3b4f3 (patch)
treedb1e93b4484bdd8ddd4edaf5eff23a504788df7c /tests
parent21b7f19ee8667e835ffe944b2498038e7bde3b16 (diff)
downloadpython-coveragepy-git-b33c041b055f0bc243790d6cce4bb32689f3b4f3.tar.gz
Mark a bunch of tests that don't need temp directories.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_cmdline.py2
-rw-r--r--tests/test_coverage.py12
-rw-r--r--tests/test_data.py2
-rw-r--r--tests/test_debug.py2
-rw-r--r--tests/test_files.py2
-rw-r--r--tests/test_html.py2
-rw-r--r--tests/test_misc.py2
-rw-r--r--tests/test_process.py4
-rw-r--r--tests/test_summary.py2
9 files changed, 26 insertions, 4 deletions
diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py
index 493ce185..2574a5ed 100644
--- a/tests/test_cmdline.py
+++ b/tests/test_cmdline.py
@@ -680,6 +680,8 @@ class CmdLineStdoutTest(CmdLineTest):
class CmdMainTest(CoverageTest):
"""Tests of coverage.cmdline.main(), using mocking for isolation."""
+ run_in_temp_dir = False
+
class CoverageScriptStub(object):
"""A stub for coverage.cmdline.CoverageScript, used by CmdMainTest."""
diff --git a/tests/test_coverage.py b/tests/test_coverage.py
index 9b421fc7..6de4d0ea 100644
--- a/tests/test_coverage.py
+++ b/tests/test_coverage.py
@@ -1696,6 +1696,8 @@ if sys.version_info >= (2, 5):
class ModuleTest(CoverageTest):
"""Tests for the module-level behavior of the `coverage` module."""
+ run_in_temp_dir = False
+
def test_not_singleton(self):
# You *can* create another coverage object.
coverage.coverage()
@@ -1705,6 +1707,10 @@ class ModuleTest(CoverageTest):
class ReportingTest(CoverageTest):
"""Tests of some reporting behavior."""
+ # We don't make any temp files, but we need an empty directory to run the
+ # tests in.
+ run_in_temp_dir = True
+
def test_no_data_to_report_on_annotate(self):
# Reporting with no data produces a nice message and no output dir.
self.assertRaisesRegexp(
@@ -1713,6 +1719,10 @@ class ReportingTest(CoverageTest):
)
self.assert_doesnt_exist("ann")
+ # CoverageTest will yell at us for using a temp directory with no files
+ # made. Instead of adding a way to shut it up, just make a file.
+ self.make_file("touch.txt", "")
+
def test_no_data_to_report_on_html(self):
# Reporting with no data produces a nice message and no output dir.
self.assertRaisesRegexp(
@@ -1727,4 +1737,4 @@ class ReportingTest(CoverageTest):
CoverageException, "No data to report.",
self.command_line, "xml"
)
- # Currently, this leaves an empty coverage.xml file... :(
+ self.assert_doesnt_exist("coverage.xml")
diff --git a/tests/test_data.py b/tests/test_data.py
index 98156a86..9c29289d 100644
--- a/tests/test_data.py
+++ b/tests/test_data.py
@@ -25,6 +25,8 @@ Y_PY_ARCS_3 = [(17,23)]
class DataTest(CoverageTest):
"""Test cases for coverage.data."""
+ run_in_temp_dir = False
+
def assert_summary(self, covdata, summary, fullpath=False):
"""Check that the summary of `covdata` is `summary`."""
self.assertEqual(covdata.summary(fullpath), summary)
diff --git a/tests/test_debug.py b/tests/test_debug.py
index 0132c1c8..985da40f 100644
--- a/tests/test_debug.py
+++ b/tests/test_debug.py
@@ -12,6 +12,8 @@ from tests.coveragetest import CoverageTest
class InfoFormatterTest(CoverageTest):
"""Tests of misc.info_formatter."""
+ run_in_temp_dir = False
+
def test_info_formatter(self):
lines = list(info_formatter([
('x', 'hello there'),
diff --git a/tests/test_files.py b/tests/test_files.py
index 26ae9100..b24e8b8b 100644
--- a/tests/test_files.py
+++ b/tests/test_files.py
@@ -168,6 +168,8 @@ class PathAliasesTest(CoverageTest):
class RelativePathAliasesTest(CoverageTest):
"""Tests for coverage/files.py:PathAliases, with relative files."""
+ run_in_temp_dir = False
+
def test_dot(self):
for d in ('.', '..', '../other', '~'):
aliases = PathAliases()
diff --git a/tests/test_html.py b/tests/test_html.py
index c0043033..e44db970 100644
--- a/tests/test_html.py
+++ b/tests/test_html.py
@@ -158,7 +158,7 @@ class HtmlDeltaTest(HtmlTestHelpers, CoverageTest):
self.assertMultiLineEqual(index1, fixed_index2)
-class HtmlTitleTests(HtmlTestHelpers, CoverageTest):
+class HtmlTitleTest(HtmlTestHelpers, CoverageTest):
"""Tests of the HTML title support."""
def test_default_title(self):
diff --git a/tests/test_misc.py b/tests/test_misc.py
index 50ddb17b..020b1425 100644
--- a/tests/test_misc.py
+++ b/tests/test_misc.py
@@ -9,6 +9,8 @@ from tests.coveragetest import CoverageTest
class HasherTest(CoverageTest):
"""Test our wrapper of md5 hashing."""
+ run_in_temp_dir = False
+
def test_string_hashing(self):
h1 = Hasher()
h1.update("Hello, world!")
diff --git a/tests/test_process.py b/tests/test_process.py
index 97e2f82b..4409c69e 100644
--- a/tests/test_process.py
+++ b/tests/test_process.py
@@ -506,9 +506,11 @@ class ProcessTest(CoverageTest):
self.assertGreater(data.summary()['os.py'], 50)
-class AliasedCommandTests(CoverageTest):
+class AliasedCommandTest(CoverageTest):
"""Tests of the version-specific command aliases."""
+ run_in_temp_dir = False
+
def test_major_version_works(self):
# "coverage2" works on py2
cmd = "coverage%d" % sys.version_info[0]
diff --git a/tests/test_summary.py b/tests/test_summary.py
index 22021997..f8426779 100644
--- a/tests/test_summary.py
+++ b/tests/test_summary.py
@@ -263,7 +263,7 @@ class SummaryTest2(CoverageTest):
self.assertIn("tests/modules/pkg2/__init__ 0 0 100%", report)
-class ReportingReturnValue(CoverageTest):
+class ReportingReturnValueTest(CoverageTest):
"""Tests of reporting functions returning values."""
def run_coverage(self):