1 new commit in pytest:
https://bitbucket.org/hpk42/pytest/commits/ebcecaa7d610/
Changeset: ebcecaa7d610
User: hpk42
Date: 2013-10-03 14:22:54
Summary: fix issue354: avoid tmpdir fixture to create too long filenames
especially
when parametrization is used
Affected #: 3 files
diff -r 0e4482f0ba672ae3e31d21cd12d5f06b15e621d7 -r
ebcecaa7d610a5ec2aa5b3367169bffc1b50415f CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -8,6 +8,9 @@
- avoid "IOError: Bad Filedescriptor" on pytest shutdown by not closing
the internal dupped stdout (fix is slightly hand-wavy but work).
+- avoid tmpdir fixture to create too long filenames especially
+ when parametrization is used (issue354)
+
Changes between 2.4.0 and 2.4.1
-----------------------------------
diff -r 0e4482f0ba672ae3e31d21cd12d5f06b15e621d7 -r
ebcecaa7d610a5ec2aa5b3367169bffc1b50415f _pytest/tmpdir.py
--- a/_pytest/tmpdir.py
+++ b/_pytest/tmpdir.py
@@ -64,5 +64,8 @@
"""
name = request.node.name
name = py.std.re.sub("[\W]", "_", name)
+ MAXVAL = 30
+ if len(name) > MAXVAL:
+ name = name[:MAXVAL]
x = request.config._tmpdirhandler.mktemp(name, numbered=True)
return x
diff -r 0e4482f0ba672ae3e31d21cd12d5f06b15e621d7 -r
ebcecaa7d610a5ec2aa5b3367169bffc1b50415f testing/test_tmpdir.py
--- a/testing/test_tmpdir.py
+++ b/testing/test_tmpdir.py
@@ -91,3 +91,12 @@
result = testdir.runpytest("-s", p, '--basetemp=%s/bt' % linktemp)
assert not result.ret
+def test_tmpdir_too_long_on_parametrization(testdir):
+ testdir.makepyfile("""
+ import pytest
+ @pytest.mark.parametrize("arg", ["1"*1000])
+ def test_some(arg, tmpdir):
+ tmpdir.ensure("hello")
+ """)
+ reprec = testdir.inline_run()
+ reprec.assertoutcome(passed=1)
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]
https://mail.python.org/mailman/listinfo/pytest-commit