only use the last part of the module name in the filename (fixes #68)
This commit is contained in:
parent
abe080c6b4
commit
661a8a4a92
|
@ -1,6 +1,7 @@
|
|||
Changes between 2.1.1 and [NEXT VERSION]
|
||||
----------------------------------------
|
||||
|
||||
- fix issue68 / packages now work with assertion rewriting
|
||||
- fix issue66: use different assertion rewriting caches when the -O option is passed
|
||||
|
||||
Changes between 2.1.0 and 2.1.1
|
||||
|
|
|
@ -77,7 +77,7 @@ class AssertionRewritingHook(object):
|
|||
# Don't know what this is.
|
||||
return None
|
||||
else:
|
||||
fn = os.path.join(pth, name + ".py")
|
||||
fn = os.path.join(pth, name.rpartition(".")[2] + ".py")
|
||||
fn_pypath = py.path.local(fn)
|
||||
# Is this a test file?
|
||||
if not sess.isinitpath(fn):
|
||||
|
|
|
@ -340,3 +340,12 @@ def test_optimized():
|
|||
assert testdir.runpybin("py.test", tmp).ret == 0
|
||||
monkeypatch.undo()
|
||||
assert testdir.runpybin("py.test", tmp).ret == 1
|
||||
|
||||
def test_package(self, testdir):
|
||||
pkg = testdir.tmpdir.join("pkg")
|
||||
pkg.mkdir()
|
||||
pkg.join("__init__.py").ensure()
|
||||
pkg.join("test_blah.py").write("""
|
||||
def test_rewritten():
|
||||
assert "@py_builtins" in globals()""")
|
||||
assert testdir.runpytest().ret == 0
|
||||
|
|
Loading…
Reference in New Issue