move sections
[python/dscho.git] / Lib / test / test_startfile.py
blob8eeae72eab47dd52113e30d28d707ede11a5b18e
1 # Ridiculously simple test of the os.startfile function for Windows.
3 # empty.vbs is an empty file (except for a comment), which does
4 # nothing when run with cscript or wscript.
6 # A possible improvement would be to have empty.vbs do something that
7 # we can detect here, to make sure that not only the os.startfile()
8 # call succeeded, but also the the script actually has run.
10 import unittest
11 from test import test_support
12 import os
13 from os import path
15 startfile = test_support.get_attribute(os, 'startfile')
18 class TestCase(unittest.TestCase):
19 def test_nonexisting(self):
20 self.assertRaises(OSError, startfile, "nonexisting.vbs")
22 def test_nonexisting_u(self):
23 self.assertRaises(OSError, startfile, u"nonexisting.vbs")
25 def test_empty(self):
26 empty = path.join(path.dirname(__file__), "empty.vbs")
27 startfile(empty)
28 startfile(empty, "open")
30 def test_empty_u(self):
31 empty = path.join(path.dirname(__file__), "empty.vbs")
32 startfile(unicode(empty, "mbcs"))
33 startfile(unicode(empty, "mbcs"), "open")
35 def test_main():
36 test_support.run_unittest(TestCase)
38 if __name__=="__main__":
39 test_main()