| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
import unittest |
| 11 |
from test import test_support |
| 12 |
import os |
| 13 |
import sys |
| 14 |
from os import path |
| 15 |
|
| 16 |
startfile = test_support.get_attribute(os, 'startfile') |
| 17 |
|
| 18 |
|
| 19 |
class TestCase(unittest.TestCase): |
| 20 |
def test_nonexisting(self): |
| 21 |
self.assertRaises(OSError, startfile, "nonexisting.vbs") |
| 22 |
|
| 23 |
def test_nonexisting_u(self): |
| 24 |
self.assertRaises(OSError, startfile, u"nonexisting.vbs") |
| 25 |
|
| 26 |
def check_empty(self, empty): |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
with test_support.change_cwd(path.dirname(sys.executable)): |
| 32 |
startfile(empty) |
| 33 |
startfile(empty, "open") |
| 34 |
|
| 35 |
def test_empty(self): |
| 36 |
empty = path.join(path.dirname(__file__), "empty.vbs") |
| 37 |
self.check_empty(empty) |
| 38 |
|
| 39 |
def test_empty_unicode(self): |
| 40 |
empty = path.join(path.dirname(__file__), "empty.vbs") |
| 41 |
empty = unicode(empty, "mbcs") |
| 42 |
self.check_empty(empty) |
| 43 |
|
| 44 |
def test_main(): |
| 45 |
test_support.run_unittest(TestCase) |
| 46 |
|
| 47 |
if __name__=="__main__": |
| 48 |
test_main() |