Skip to content

Commit 2e39fd8

Browse files
add python27 support by using reduce instead of max
1 parent b48e23d commit 2e39fd8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/_pytest/tmpdir.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from __future__ import absolute_import, division, print_function
33

44
import re
5+
from six.moves import reduce
56

67
import pytest
78
import py
@@ -24,13 +25,14 @@ def parse_num(p, cut=len(l_prefix)):
2425

2526
for i in range(10):
2627
# try up to 10 times to create the folder
27-
max_existing = max(
28+
max_existing = reduce(
29+
max,
2830
(
2931
parse_num(x)
3032
for x in root.iterdir()
3133
if x.name.lower().startswith(l_prefix)
3234
),
33-
default=-1,
35+
-1,
3436
)
3537
new_number = max_existing + 1
3638
new_path = root.joinpath("{}{}".format(prefix, new_number))

0 commit comments

Comments
 (0)