File tree 2 files changed +4
-8
lines changed 2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change 5
5
import tempfile
6
6
import sysconfig
7
7
import itertools
8
+ import pathlib
8
9
9
10
import pytest
11
+ from more_itertools import always_iterable
10
12
11
13
from distutils .core import Distribution
12
14
@@ -29,16 +31,9 @@ def mkdtemp(self):
29
31
def write_file (self , path , content = 'xxx' ):
30
32
"""Writes a file in the given path.
31
33
32
-
33
34
path can be a string or a sequence.
34
35
"""
35
- if isinstance (path , (list , tuple )):
36
- path = os .path .join (* path )
37
- f = open (path , 'w' )
38
- try :
39
- f .write (content )
40
- finally :
41
- f .close ()
36
+ pathlib .Path (* always_iterable (path )).write_text (content )
42
37
43
38
def create_dist (self , pkg_name = 'foo' , ** kw ):
44
39
"""Will generate a test environment.
Original file line number Diff line number Diff line change 22
22
path
23
23
docutils
24
24
pyfakefs
25
+ more_itertools
25
26
commands =
26
27
pytest {posargs}
27
28
setenv =
You can’t perform that action at this time.
0 commit comments