3 new commits in pytest:
https://bitbucket.org/hpk42/pytest/commits/88cff89ea222/
Changeset: 88cff89ea222
User: hpk42
Date: 2013-06-23 09:24:48
Summary: mention added support for setUpModule/tearDownModule detection,
thanks Brian Okken.
Affected #: 4 files
diff -r 0df9999d1bd00ba3f109dcc76398b861744b15b1 -r
88cff89ea2229b62d36be11934e453173a57b26c AUTHORS
--- a/AUTHORS
+++ b/AUTHORS
@@ -30,3 +30,4 @@
Daniel Nuri
Graham Horler
Andreas Zeidler
+Brian Okken
diff -r 0df9999d1bd00ba3f109dcc76398b861744b15b1 -r
88cff89ea2229b62d36be11934e453173a57b26c CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,8 @@
Changes between 2.3.5 and 2.4.DEV
-----------------------------------
+- add support for setUpModule/tearDownModule detection, thanks Brian Okken.
+
- make sessionfinish hooks execute with the same cwd-context as at
session start (helps fix plugin behaviour which write output files
with relative path such as pytest-cov)
diff -r 0df9999d1bd00ba3f109dcc76398b861744b15b1 -r
88cff89ea2229b62d36be11934e453173a57b26c _pytest/__init__.py
--- a/_pytest/__init__.py
+++ b/_pytest/__init__.py
@@ -1,2 +1,2 @@
#
-__version__ = '2.4.0.dev3'
+__version__ = '2.4.0.dev4'
diff -r 0df9999d1bd00ba3f109dcc76398b861744b15b1 -r
88cff89ea2229b62d36be11934e453173a57b26c setup.py
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,7 @@
name='pytest',
description='py.test: simple powerful testing with Python',
long_description = long_description,
- version='2.4.0.dev3',
+ version='2.4.0.dev4',
url='http://pytest.org',
license='MIT license',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
https://bitbucket.org/hpk42/pytest/commits/e4e280bd27d5/
Changeset: e4e280bd27d5
User: hpk42
Date: 2013-06-28 12:54:10
Summary: some internal renaming to make more sense of the sorting algo,
no semantical changes.
Affected #: 1 file
diff -r 88cff89ea2229b62d36be11934e453173a57b26c -r
e4e280bd27d5e72469d3965a0fb0be28a769f9c2 _pytest/python.py
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -1747,29 +1747,31 @@
def parametrize_sorted(items, ignore, cache, scopenum):
if scopenum >= 3:
return items
- newitems = []
- olditems = []
+ similar_items = []
+ other_items = []
slicing_argparam = None
for item in items:
argparamlist = getfuncargparams(item, ignore, scopenum, cache)
if slicing_argparam is None and argparamlist:
slicing_argparam = argparamlist[0]
- slicing_index = len(olditems)
+ slicing_index = len(other_items)
if slicing_argparam in argparamlist:
- newitems.append(item)
+ similar_items.append(item)
else:
- olditems.append(item)
- if newitems:
+ other_items.append(item)
+ if similar_items:
newignore = ignore.copy()
newignore.add(slicing_argparam)
- newitems = parametrize_sorted(newitems + olditems[slicing_index:],
- newignore, cache, scopenum)
- old1 = parametrize_sorted(olditems[:slicing_index], newignore,
- cache, scopenum+1)
- return old1 + newitems
+ part2 = parametrize_sorted(
+ similar_items + other_items[slicing_index:],
+ newignore, cache, scopenum)
+ part1 = parametrize_sorted(
+ other_items[:slicing_index], newignore,
+ cache, scopenum+1)
+ return part1 + part2
else:
- olditems = parametrize_sorted(olditems, ignore, cache, scopenum+1)
- return olditems + newitems
+ other_items = parametrize_sorted(other_items, ignore, cache,
scopenum+1)
+ return other_items + similar_items
def getfuncargparams(item, ignore, scopenum, cache):
""" return list of (arg,param) tuple, sorted by broader scope first. """
https://bitbucket.org/hpk42/pytest/commits/4cddadcc82d0/
Changeset: 4cddadcc82d0
User: hpk42
Date: 2013-06-28 12:57:10
Summary: fix issue323 - parametrize() of many module-scoped params
Affected #: 6 files
diff -r e4e280bd27d5e72469d3965a0fb0be28a769f9c2 -r
4cddadcc82d062982cd37f42f669a332f8ba372f CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,8 @@
Changes between 2.3.5 and 2.4.DEV
-----------------------------------
+- fix issue323 - sorting of many module-scoped arg parametrizations
+
- add support for setUpModule/tearDownModule detection, thanks Brian Okken.
- make sessionfinish hooks execute with the same cwd-context as at
diff -r e4e280bd27d5e72469d3965a0fb0be28a769f9c2 -r
4cddadcc82d062982cd37f42f669a332f8ba372f _pytest/__init__.py
--- a/_pytest/__init__.py
+++ b/_pytest/__init__.py
@@ -1,2 +1,2 @@
#
-__version__ = '2.4.0.dev4'
+__version__ = '2.4.0.dev5'
diff -r e4e280bd27d5e72469d3965a0fb0be28a769f9c2 -r
4cddadcc82d062982cd37f42f669a332f8ba372f _pytest/python.py
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -1747,9 +1747,16 @@
def parametrize_sorted(items, ignore, cache, scopenum):
if scopenum >= 3:
return items
+
+ # we pick the first item which has a arg/param combo in the
+ # requested scope and sort other items with the same combo
+ # into "newitems" which then is a list of all items using this
+ # arg/param.
+
similar_items = []
other_items = []
slicing_argparam = None
+ slicing_index = 0
for item in items:
argparamlist = getfuncargparams(item, ignore, scopenum, cache)
if slicing_argparam is None and argparamlist:
@@ -1759,7 +1766,8 @@
similar_items.append(item)
else:
other_items.append(item)
- if similar_items:
+
+ if (len(similar_items) + slicing_index) > 1:
newignore = ignore.copy()
newignore.add(slicing_argparam)
part2 = parametrize_sorted(
diff -r e4e280bd27d5e72469d3965a0fb0be28a769f9c2 -r
4cddadcc82d062982cd37f42f669a332f8ba372f setup.py
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,7 @@
name='pytest',
description='py.test: simple powerful testing with Python',
long_description = long_description,
- version='2.4.0.dev4',
+ version='2.4.0.dev5',
url='http://pytest.org',
license='MIT license',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
diff -r e4e280bd27d5e72469d3965a0fb0be28a769f9c2 -r
4cddadcc82d062982cd37f42f669a332f8ba372f testing/python/metafunc.py
--- a/testing/python/metafunc.py
+++ b/testing/python/metafunc.py
@@ -555,6 +555,20 @@
reprec = testdir.inline_run()
reprec.assertoutcome(passed=5)
+ def test_parametrize_issue323(self, testdir):
+ testdir.makepyfile("""
+ import pytest
+
+ @pytest.fixture(scope='module', params=range(966))
+ def foo(request):
+ return request.param
+
+ def test_it(foo):
+ pass
+ """)
+ reprec = testdir.inline_run("--collectonly")
+ assert not reprec.getcalls("pytest_internalerror")
+
def test_usefixtures_seen_in_generate_tests(self, testdir):
testdir.makepyfile("""
import pytest
diff -r e4e280bd27d5e72469d3965a0fb0be28a769f9c2 -r
4cddadcc82d062982cd37f42f669a332f8ba372f tox.ini
--- a/tox.ini
+++ b/tox.ini
@@ -98,4 +98,4 @@
python_classes=Test Acceptance
python_functions=test
pep8ignore = E401 E225 E261 E128 E124 E302
-norecursedirs = .tox ja
+norecursedirs = .tox ja .hg
Repository URL: https://bitbucket.org/hpk42/pytest/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
pytest-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pytest-commit