Skip to content

Commit 692cd3b

Browse files
Vasil ChimevVasil Chimev
Vasil Chimev
authored and
Vasil Chimev
committed
Add create_folder().
1 parent 15a57a6 commit 692cd3b

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

helpers/_os_lib.py

+16-7
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,22 @@ def fork_it():
8080

8181
return out.strip('\n\r')
8282

83+
def create_folder(folder):
84+
'''Create folder'''
85+
if not os.path.exists(folder):
86+
try:
87+
os.makedirs(folder)
88+
except OSError:
89+
if not os.path.isdir(folder):
90+
raise
91+
92+
def folder_exists(path):
93+
'''Check if folder exists'''
94+
if os.path.isdir(path):
95+
return True
96+
else:
97+
return False
98+
8399
def cleanup_folder(folder):
84100
'''Cleanup folder'''
85101
try:
@@ -145,13 +161,6 @@ def is_empty(path):
145161
else:
146162
return False
147163

148-
def folder_exists(path):
149-
'''Check if folder exists'''
150-
if os.path.isdir(path):
151-
return True
152-
else:
153-
return False
154-
155164
def file_exists(path):
156165
'''Check if file exists'''
157166
if os.path.exists(path):

tests/livesync_simulator.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import shutil, time
1111

12-
from helpers._os_lib import cleanup_folder, replace, remove
12+
from helpers._os_lib import create_folder, cleanup_folder, replace, remove
1313
from helpers._tns_lib import IOS_RUNTIME_SYMLINK_PATH, \
1414
create_project, platform_add, run, livesync, TNS_PATH
1515
from helpers.device import stop_emulators
@@ -97,6 +97,11 @@ def test_001_full_livesync_ios_simulator_xml_js_css_tns_files(self):
9797
assert "require(\"globals\"); // test" in output
9898

9999

100+
# # Add a new folder
101+
# def test_100_livesync_ios_simulator_watch_add_new_folder(self):
102+
# create_folder("folder")
103+
104+
100105
# Add new files
101106
def test_101_livesync_ios_simulator_watch_add_xml_file(self):
102107
shutil.copyfile("TNS_App/app/main-page.xml", "TNS_App/app/test/test.xml")

0 commit comments

Comments
 (0)