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
commitf360498ba0294dfef288f5fff0e8a3ba291881b2 (patch)
tree6efecd6c6f90661e1ab38a544f786aed1895b4ba /tests
parent2024650297ec269a730b3d67fbc56f6c7c8317f6 (diff)
downloadpython-coveragepy-f360498ba0294dfef288f5fff0e8a3ba291881b2.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 493ce18..2574a5e 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 9b421fc..6de4d0e 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 98156a8..9c29289 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 0132c1c..985da40 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 26ae910..b24e8b8 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 c004303..e44db97 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 50ddb17..020b142 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 97e2f82..4409c69 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 2202199..f842677 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):