summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2012-12-21 07:41:01 -0500
committerNed Batchelder <ned@nedbatchelder.com>2012-12-21 07:41:01 -0500
commit502fe3685098b7b0a9524c2e2de0d0db9de06ed9 (patch)
treeb4e66e248ab3f41d6541726d9cd3b36ae4a87fa2
parenta1f6641ca9d2e5cc395671ab6fe82b65949552a4 (diff)
parent9addc84bb39eddeccd31ee5a5f0fa387591e35dd (diff)
downloadpython-coveragepy-git-502fe3685098b7b0a9524c2e2de0d0db9de06ed9.tar.gz
Automated merge with ssh://bitbucket.org/ned/coveragepy
-rw-r--r--.treerc2
-rw-r--r--igor.py16
-rw-r--r--test/eggsrc/setup.py2
-rw-r--r--test/test_codeunit.py7
-rw-r--r--tox.ini9
5 files changed, 29 insertions, 7 deletions
diff --git a/.treerc b/.treerc
index 4c0ac416..4037aed9 100644
--- a/.treerc
+++ b/.treerc
@@ -13,4 +13,4 @@ ignore =
*.so *.pyd
*.gz *.zip
_build
- *.egg-info
+ *.egg *.egg-info
diff --git a/igor.py b/igor.py
index fd615459..1af984a0 100644
--- a/igor.py
+++ b/igor.py
@@ -126,12 +126,26 @@ def do_zip_mods():
zf.write("test/covmodzip1.py", "covmodzip1.py")
zf.close()
+def do_install_egg():
+ """Install the egg1 egg for tests."""
+ # I am pretty certain there are easier ways to install eggs...
+ # pylint: disable=F0401,E0611,E1101
+ import distutils.core
+ cur_dir = os.getcwd()
+ os.chdir("test/eggsrc")
+ distutils.core.run_setup("setup.py", ["--quiet", "bdist_egg"])
+ egg = glob.glob("dist/*.egg")[0]
+ distutils.core.run_setup(
+ "setup.py", ["--quiet", "easy_install", "--no-deps", "--zip-ok", egg]
+ )
+ os.chdir(cur_dir)
+
def do_check_eol():
"""Check files for incorrect newlines and trailing whitespace."""
ignore_dirs = [
'.svn', '.hg', '.tox', '.tox_kits', 'coverage.egg-info',
- '_build',
+ '_build', 'covtestegg1.egg-info',
]
checked = set([])
diff --git a/test/eggsrc/setup.py b/test/eggsrc/setup.py
index 6a88a58b..f9b8b9d0 100644
--- a/test/eggsrc/setup.py
+++ b/test/eggsrc/setup.py
@@ -3,4 +3,6 @@ from setuptools import setup
setup(
name="covtestegg1",
packages=['egg1'],
+ zip_safe=True,
+ install_requires=[],
)
diff --git a/test/test_codeunit.py b/test/test_codeunit.py
index b543949c..a568fe56 100644
--- a/test/test_codeunit.py
+++ b/test/test_codeunit.py
@@ -89,7 +89,14 @@ class CodeUnitTest(CoverageTest):
assert bcu > acu and bcu >= acu and bcu != acu
def test_egg(self):
+ # Test that we can get files out of eggs, and read their source files.
+ # The egg1 module is installed by an action in igor.py.
import egg1, egg1.egg1
+ # Verify that we really imported from an egg. If we did, then the
+ # __file__ won't be an actual file, because one of the "directories"
+ # in the path is actually the .egg zip file.
+ self.assert_doesnt_exist(egg1.__file__)
+
cu = code_unit_factory([egg1, egg1.egg1], FileLocator())
self.assertEqual(cu[0].source_file().read(), "")
self.assertEqual(cu[1].source_file().read().split("\n")[0],
diff --git a/tox.ini b/tox.ini
index a14c67cf..a09ddbbe 100644
--- a/tox.ini
+++ b/tox.ini
@@ -7,16 +7,16 @@
envlist = py25, py26, py27, py31, py32, py33, pypy
[testenv]
-setenv =
- PYTHONPATH=test/eggsrc
-
commands =
{envpython} setup.py --quiet clean develop
# Create test/zipmods.zip
+ # Install the egg1 egg
# Remove the C extension so that we can test the PyTracer
+ {envpython} igor.py zip_mods install_egg remove_extension
+
# Test with the PyTracer
- {envpython} igor.py zip_mods remove_extension test_with_tracer py {posargs}
+ {envpython} igor.py test_with_tracer py {posargs}
# Build the C extension and test with the CTracer
{envpython} setup.py --quiet build_ext --inplace
@@ -29,5 +29,4 @@ deps =
[testenv:pypy]
# PyPy has no C extensions
setenv =
- PYTHONPATH=test/eggsrc
COVERAGE_NO_EXTENSION=1