Skip to content

Commit 0f54934

Browse files
Vasil ChimevVasil Chimev
Vasil Chimev
authored and
Vasil Chimev
committed
Add test_001_Output_STRERR() test.
NativeScript/nativescript-cli#793
1 parent ab8d7f3 commit 0f54934

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

helpers/_os_lib.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import fileinput
2-
import os, threading, psutil, time, shutil
1+
import os, errno, fileinput, time, threading, psutil, shutil
32
import platform
43
import tarfile
54
from time import sleep
@@ -164,6 +163,13 @@ def catAppFile(platform, appName, filePath):
164163
output = runAUT("ddb device get-file \"Library/Application Support/LiveSync/" + filePath +"\" --app org.nativescript." + appName)
165164
return output
166165

166+
def remove(file_path):
167+
try:
168+
os.remove(file_path)
169+
except OSError as e:
170+
if e.errno != errno.ENOENT: # errno.ENOENT = no such file or directory
171+
raise
172+
167173
def uninstall_app(appName):
168174
output = runAUT("ddb device uninstall org.nativescript." + appName)
169175
if ("[Uninstalling] Status: RemovingApplication" in output):

tests/output_stderr.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import os, unittest
2+
3+
from helpers._os_lib import remove, runAUT
4+
from helpers._tns_lib import tnsPath
5+
6+
class Output_STRERR(unittest.TestCase):
7+
8+
def setUp(self):
9+
10+
print ""
11+
print "#####"
12+
print self.id()
13+
print "#####"
14+
print ""
15+
16+
remove('stderr.txt');
17+
18+
def tearDown(self):
19+
remove('stderr.txt');
20+
21+
def test_001_Output_STRERR(self):
22+
os.system(tnsPath + " emulate asdf 2>stderr.txt")
23+
output = runAUT("cat stderr.txt")
24+
assert ("The input is not valid sub-command for 'emulate' command" in output)

0 commit comments

Comments
 (0)