merge with default

--HG--
branch : issue463
This commit is contained in:
Anatoly Bubenkov 2015-03-23 20:41:27 +01:00
commit ce95437dee
7 changed files with 36 additions and 4 deletions

View File

@ -1,7 +1,8 @@
2.7.0.dev (compared to 2.6.4)
-----------------------------
- fix issue463: raise specific error for 'parameterize' misspelling.
- fix issue435: make reload() work when assert rewriting is active.
Thanks Daniel Hahler.
- fix issue616: conftest.py files and their contained fixutres are now
properly considered for visibility, independently from the exact
@ -59,6 +60,8 @@
- allow to override parametrized fixtures with non-parametrized ones and vice versa (bubenkoff).
- fix issue463: raise specific error for 'parameterize' misspelling (pfctdayelise).
2.6.4
----------

View File

@ -146,6 +146,12 @@ class AssertionRewritingHook(object):
return self
def load_module(self, name):
# If there is an existing module object named 'fullname' in
# sys.modules, the loader must use that existing module. (Otherwise,
# the reload() builtin will not work correctly.)
if name in sys.modules:
return sys.modules[name]
co, pyc = self.modules.pop(name)
# I wish I could just call imp.load_compiled here, but __file__ has to
# be set properly. In Python 3.2+, this all would be handled correctly

View File

@ -778,7 +778,6 @@ class Metafunc(FuncargnamesCompatAttr):
self.fixturenames = fixtureinfo.names_closure
self._arg2fixturedefs = fixtureinfo.name2fixturedefs
self.cls = cls
self.module = module
self._calls = []
self._ids = py.builtin.set()

View File

@ -67,7 +67,6 @@ using it::
def test_ehlo(smtp):
response, msg = smtp.ehlo()
assert response == 250
assert "merlinux" in msg
assert 0 # for demo purposes
Here, the ``test_ehlo`` needs the ``smtp`` fixture value. pytest

View File

@ -26,6 +26,7 @@ Here are some examples of projects using ``pytest`` (please send notes via :ref:
`21000 tests <http://buildbot.pypy.org/summary?branch=%3Ctrunk%3E>`_
* the `MoinMoin <http://moinmo.in>`_ Wiki Engine
* `sentry <https://getsentry.com/welcome/>`_, realtime app-maintenance and exception tracking
* `Astropy <http://www.astropy.org/>`_ and `affiliated packages <http://www.astropy.org/affiliated/index.html>`_
* `tox <http://testrun.org/tox>`_, virtualenv/Hudson integration tool
* `PIDA <http://pida.co.uk>`_ framework for integrated development
* `PyPM <http://code.activestate.com/pypm/>`_ ActiveState's package manager

View File

@ -641,3 +641,27 @@ class TestAssertionRewriteHookDetails(object):
pyc.write(contents[:strip_bytes], mode='wb')
assert _read_pyc(source, str(pyc)) is None # no error
def test_reload_is_same(self, testdir):
# A file that will be picked up during collecting.
testdir.tmpdir.join("file.py").ensure()
testdir.tmpdir.join("pytest.ini").write(py.std.textwrap.dedent("""
[pytest]
python_files = *.py
"""))
testdir.makepyfile(test_fun="""
import sys
try:
from imp import reload
except ImportError:
pass
def test_loader():
import file
assert sys.modules["file"] is reload(file)
""")
result = testdir.runpytest('-s')
result.stdout.fnmatch_lines([
"* 1 passed*",
])

View File

@ -136,7 +136,7 @@ commands=
minversion=2.0
plugins=pytester
#--pyargs --doctest-modules --ignore=.tox
addopts= -rxsX -vl
addopts= -rxsX
rsyncdirs=tox.ini pytest.py _pytest testing
python_files=test_*.py *_test.py testing/*/*.py
python_classes=Test Acceptance