parent
							
								
									dc5e2f5ed3
								
							
						
					
					
						commit
						56afcfc9f3
					
				|  | @ -8,7 +8,7 @@ usage example:: | ||||||
| .. _`py.path.local`: ../../path.html | .. _`py.path.local`: ../../path.html | ||||||
| 
 | 
 | ||||||
| """ | """ | ||||||
| import pytest | import pytest, py | ||||||
| 
 | 
 | ||||||
| def pytest_configure(config): | def pytest_configure(config): | ||||||
|     def ensuretemp(string, dir=1): |     def ensuretemp(string, dir=1): | ||||||
|  | @ -30,5 +30,6 @@ def pytest_funcarg__tmpdir(request): | ||||||
|     path object. |     path object. | ||||||
|     """ |     """ | ||||||
|     name = request._pyfuncitem.name |     name = request._pyfuncitem.name | ||||||
|  |     name = py.std.re.sub("[\W]", "_", name) | ||||||
|     x = request.config.mktemp(name, numbered=True) |     x = request.config.mktemp(name, numbered=True) | ||||||
|     return x.realpath() |     return x.realpath() | ||||||
|  |  | ||||||
|  | @ -13,7 +13,12 @@ def test_funcarg(testdir): | ||||||
|     p = pytest_funcarg__tmpdir(FuncargRequest(item)) |     p = pytest_funcarg__tmpdir(FuncargRequest(item)) | ||||||
|     assert p.check() |     assert p.check() | ||||||
|     bn = p.basename.strip("0123456789") |     bn = p.basename.strip("0123456789") | ||||||
|     assert bn.endswith("test_func[a]") |     assert bn.endswith("test_func_a_") | ||||||
|  |     item.name = "qwe/\\abc" | ||||||
|  |     p = pytest_funcarg__tmpdir(FuncargRequest(item)) | ||||||
|  |     assert p.check() | ||||||
|  |     bn = p.basename.strip("0123456789") | ||||||
|  |     assert bn == "qwe__abc" | ||||||
| 
 | 
 | ||||||
| def test_ensuretemp(recwarn): | def test_ensuretemp(recwarn): | ||||||
|     #py.test.deprecated_call(py.test.ensuretemp, 'hello') |     #py.test.deprecated_call(py.test.ensuretemp, 'hello') | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue