Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
test_utils.FileWriter Class Reference
Inheritance diagram for test_utils.FileWriter:

Public Member Functions

 __init__ (self, cwd)
 
 mkdir (self, dname, mode=0o755)
 
 write (self, fname, mode=0o640)
 
 remove (self, fname)
 

Protected Attributes

 _cwd
 

Detailed Description

Write files into a given directory.

Definition at line 17 of file test_utils.py.

Constructor & Destructor Documentation

◆ __init__()

test_utils.FileWriter.__init__ (   self,
  cwd 
)

Definition at line 19 of file test_utils.py.

19 def __init__(self, cwd):
20 self._cwd = cwd
21 if not os.path.exists(self._cwd):
22 os.makedirs(self._cwd)
23

Member Function Documentation

◆ mkdir()

test_utils.FileWriter.mkdir (   self,
  dname,
  mode = 0o755 
)
Create the given directory with the given mode.

Definition at line 24 of file test_utils.py.

24 def mkdir(self, dname, mode=0o755):
25 """Create the given directory with the given mode."""
26 dname = os.path.join(self._cwd, dname)
27 os.mkdir(dname)
28 os.chmod(dname, mode)
29

◆ remove()

test_utils.FileWriter.remove (   self,
  fname 
)
Remove the file.

Definition at line 37 of file test_utils.py.

37 def remove(self, fname):
38 """Remove the file."""
39 fname = os.path.join(self._cwd, fname)
40 if os.path.isfile(fname):
41 os.remove(fname)
42 else:
43 os.rmdir(fname)
44
45

◆ write()

test_utils.FileWriter.write (   self,
  fname,
  mode = 0o640 
)
Write the file with the given mode and random contents.

Definition at line 30 of file test_utils.py.

30 def write(self, fname, mode=0o640):
31 """Write the file with the given mode and random contents."""
32 fname = os.path.join(self._cwd, fname)
33 with open(fname, 'w') as f:
34 f.write(str(uuid.uuid4()))
35 os.chmod(fname, mode)
36
void write(SkWStream *wStream, const T &text)
Definition skqp.cpp:188

Member Data Documentation

◆ _cwd

test_utils.FileWriter._cwd
protected

Definition at line 20 of file test_utils.py.


The documentation for this class was generated from the following file: